/* ─────────────────────────────────────────────────────
   IMPS Invoice Generator — extends css/base.css
   Reuses tokens: --orange, --cream, --ink, etc.
───────────────────────────────────────────────────── */

.main {
  max-width: min(1800px, 100vw);
  padding: 32px 24px 64px;
}

.page-sub {
  margin-top: 2px;
  color: var(--ink-light);
  font-size: 14px;
}

/* ── Wizard card ── */
.wizard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

/* Keep channel review columns aligned when filters, pages or selections change. */
.channel-resolution-table { table-layout: fixed; min-width: 680px; }
.channel-resolution-table th:first-child { width: 30%; }
.channel-resolution-table th:last-child { width: 140px; }
.channel-resolution-table td { overflow-wrap: anywhere; }

/* Used for any "title on the left, controls on the right" header inside a card. */

/* Back-button modifier on .btn-ghost — flush-left, sits above a page card. */

/* ── AdSales workflow page frame ──────────────────────────────────────────────
   The wizard, report and billing-upload screens keep their own markup but share
   the portal's page frame: .preview-header is the page header (title, status,
   actions — same as .ui-pagebar) and .preview-body is the card below it (same
   as .ui-card). */
.preview-card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.preview-header > :first-child { flex: 1 1 auto; min-width: 0; }

.preview-body {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.preview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Lock structural columns so widths line up across orders within a customer.
   ID widened from 110→150px so typical SMURF IDs fit on one line. */

/* The ID cell should never wrap — typical SMURF IDs are ~17 chars at 11px
   mono, comfortably fitting 150px. If a future ID is longer, ellipsis it
   rather than break the column rhythm. */

/* ═══════════════════════════════════════════════════════════════
   SPA — new views (role-aware shell, dashboards, invoice detail,
   settings). Reuses all tokens from base.css + invoicer.css.
   ═══════════════════════════════════════════════════════════════ */

/* ── Header user block ── */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.header-user-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.header-user-role {
  font-size: 11px;
  color: var(--ink-light);
  text-transform: capitalize;
}

/* ── Loading / center state ── */
.center-message {
  padding: 80px;
  text-align: center;
  color: var(--ink-light);
}
.spinner-lg {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(232,80,10,0.18);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── Login page ── */
.microsoft-login {
  margin-top: 22px;
}
.microsoft-login-button {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-weight: 600;
}
.microsoft-login-button:hover {
  background: var(--surface-warm);
}
.microsoft-login-divider {
  margin-top: 18px;
  color: var(--ink-light);
  font-size: 12px;
  text-align: center;
}
.login-unavailable {
  margin-top: 22px;
  color: var(--ink-light);
  font-size: 13px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 22px;
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.otp-box {
  width: 100%;
  aspect-ratio: 1;
  min-height: 48px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.otp-box:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232, 80, 10, 0.12);
}

/* ── Login page dev-user list ── */
.dev-user-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dev-user-btn:hover {
  border-color: var(--orange-light);
  box-shadow: var(--shadow);
}

/* Role badges (login page) */

/* ── Invoice list table ── */
/* Numeric columns in the report data table */
.data-table th.num-col {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  white-space: normal;
  overflow: visible;
  vertical-align: bottom;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  line-height: 1.3;
}
.data-table td.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 4px;
  padding-right: 8px;
}
.data-table th.int-col {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  white-space: normal;
  overflow: visible;
  vertical-align: bottom;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  line-height: 1.3;
}
.data-table td.int-col {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 4px;
  padding-right: 8px;
}

/* Fix: tab-bar inside wizard-card — override the id-specific rule so it
   works for dynamically-created tab bars too */

/* ─────────────────────────────────────────────
   End SPA additions
───────────────────────────────────────────── */

@media (max-width: 760px) {
  .preview-header {
    flex-direction: column;
    gap: 16px;
  }

  .preview-actions {
    width: 100%;
    flex-wrap: wrap;
  }

}

/* ── x-cloak (hide until Alpine initialises) ── */
[x-cloak] { display: none !important; }

/* ── Header user dropdown ── */
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.header-user-btn:hover {
  background: var(--surface-warm);
  border-color: var(--border);
}

.header-user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 200;
}
.header-user-menu-label {
  padding: 8px 12px 4px;
  color: var(--ink-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.header-user-menu-role {
  float: right;
  color: var(--ink-light);
  margin-left: 16px;
}
.header-user-menu-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.header-user-menu-item:hover {
  background: var(--orange-pale);
  color: var(--orange);
}

/* ── Modal overlay (confirm / reject) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 27, 35, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  padding: 20px;
}
.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-style: italic;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-light);
  padding: 4px 8px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}
.contract-editor-body {
  display: grid;
  gap: 16px;
}
.contract-editor-body .price-input {
  width: auto;
  text-align: left;
}
.contract-term-type .price-input { width: min(290px, 100%); }
.contract-fixed-share { width: 160px; }

.contract-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 230px));
  gap: 14px;
}
.contract-date-grid .price-input { width: 100%; }
.contract-tier-table {
  width: min(540px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.contract-tier-head,
.contract-tier-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px 132px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
}
.contract-tier-head {
  background: var(--surface-warm);
  color: var(--ink-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.contract-tier-row + .contract-tier-row { border-top: 1px solid var(--border); }
.contract-tier-row .price-input { width: 100%; padding: 6px 8px; }
.contract-money-input,
.contract-month-input,
.contract-suffix-input {
  display: flex;
  align-items: center;
  gap: 6px;
}
.contract-money-input > span,
.contract-month-input > span,
.contract-suffix-input > span {
  color: var(--ink-light);
  font-size: 13px;
  white-space: nowrap;
}
.contract-money-input .price-input { width: 138px; }
.contract-month-input .price-input { width: 76px; }
.contract-suffix-input .price-input { width: 72px; }
.contract-unlimited { color: var(--ink-light); font-size: 13px; padding-left: 2px; }
.contract-tier-actions { display: flex; justify-content: flex-end; gap: 4px; }
.contract-tier-actions .btn-ghost { font-size: 12px; }
.contract-add-tier { margin-top: 8px; }
.contract-optional-field { max-width: 360px; }
.contract-optional-toggle { justify-self: start; color: var(--blue); }
.field-help { margin-top: 5px; color: var(--ink-light); font-size: 12px; line-height: 1.35; }
@media (max-width: 620px) {
  .contract-date-grid { grid-template-columns: 1fr; }
  .contract-tier-head,
  .contract-tier-row { grid-template-columns: minmax(0, 1fr) 98px 90px; }
  .contract-tier-actions .btn-ghost:first-child { display: none; }
}
.modal-header h2 { margin: 0; }
.modal-title-confirm { color: var(--green); }

/* Spinner variants — match button background so the spinner reads correctly. */

.spinner-on-light {
  border-color: rgba(26,20,16,0.15);
  border-top-color: var(--ink-mid);
}

/* Carryover pill — color override of .lang-pill for the carryover badge. */

/* ── Settings page — section headers ───────────────────────────────────────── */

.settings-subsection-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 12px;
}

/* ── Period picker (Ops wizard step 1) ─────────────────────────────────────── */
.period-picker {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ── Pricing form (Finance) ──────────────────────────────────────────── */

.price-input {
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.price-input:hover { border-color: var(--border-dark); }
.price-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,80,10,0.1);
}

/* ═══════════════════════════════════════════════════════════════
   YT-specific components — built on the shared base.css tokens.
   ═══════════════════════════════════════════════════════════════ */

/* ── File drop zones (wizard step 1) ── */
.dropzone-grid {
  display: grid;
  grid-template-columns: minmax(280px, 760px);
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}
/* Two side-by-side narrow dropzones (e.g. GAM + Ad Manager report in step 1). */
.dropzone-grid.dual {
  grid-template-columns: repeat(2, minmax(220px, 370px));
}
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 40px 20px;
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  background: var(--surface-warm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--orange); background: var(--orange-pale); }
.dropzone.filled { border-style: solid; border-color: var(--green); background: var(--green-pale); }
.dropzone-icon { font-size: 26px; color: var(--orange); line-height: 1; }
.dropzone.filled .dropzone-icon { color: var(--green); }
.dropzone-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.dropzone-hint { font-size: 12px; color: var(--ink-light); overflow-wrap: anywhere; word-break: break-word; }

/* ── Wide data table (Rapportgegevens preview / lookups) ── */
.data-scroll {
  max-height: 60vh;
  overflow: auto;
  contain: paint;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
/* Full-height variant: render the whole table without an inner scroll area. */
.data-scroll.data-scroll--full {
  max-height: none;
  overflow: visible;
  contain: none;
}

/* PXR settlement tables can be wider than the report card. Keep each table
   inside its own section and expose a horizontal scrollbar when needed. */
.pxr-tab,
.pxr-je-tab {
  min-width: 0;
  max-width: 100%;
}
.pxr-tab .data-scroll.data-scroll--full,
.pxr-je-tab .data-scroll.data-scroll--full {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  contain: paint;
  scrollbar-width: thin;
}
.pxr-tab .data-scroll.data-scroll--full > .inv-table,
.pxr-je-tab .data-scroll.data-scroll--full > .inv-table {
  width: max-content;
  min-width: 100%;
}

.customer-lineitem-col {
  min-width: 0;
}

.lookup-data-scroll {
  height: 56vh;
  min-height: 260px;
}

/* Keep paginated data tables from collapsing to just the header when a filter
   (e.g. "Needs review only") leaves zero matching rows, without adding a
   large blank scroller below short tables. */
.data-scroll.data-scroll--fixed:has(tbody:empty) { min-height: 180px; }
.review-data-scroll {
  height: 60vh;
  min-height: 360px;
  padding-bottom: 18px;
  box-sizing: border-box;
}
.data-table {
  --editable-cell-width: 150px;
}
.data-table th {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface-warm);
  white-space: nowrap;
}
.data-table td { white-space: nowrap; }
.data-table tbody tr:hover td { background: var(--surface-warm); }
.data-table th.lookup-pct-col,
.data-table td.lookup-pct-col {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.data-table th.lookup-bureau-col,
.data-table td.lookup-bureau-col {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table th.lookup-rule-check-col,
.data-table td.lookup-rule-check-col {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
  overflow: hidden;
}
.lookup-rule-check-col .lookup-edit-cell {
  justify-content: center;
}
.lookup-rule-check-col .lookup-checkbox {
  margin: 0 auto;
}
.channel-map-table th:nth-child(n+3),
.channel-map-table td:nth-child(n+3) {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}
.channel-map-table td:nth-child(n+3) input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}
.lookup-edit-cell,
.lookup-row-actions {
  min-height: 28px;
  display: flex;
  align-items: center;
}
.lookup-pct-col .lookup-edit-cell {
  justify-content: flex-end;
}
.lookup-percent-input-wrap {
  display: inline-flex;
  align-items: center;
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  height: 26px;
}
.lookup-percent-input {
  width: 44px;
  min-width: 0;
  height: 26px;
  padding: 3px 5px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  font-size: 12px;
  text-align: right;
}
.lookup-percent-symbol {
  width: 18px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-dark);
  border-left: 0;
  border-right: 0;
  background: var(--surface);
  color: var(--ink-light);
  font-size: 11px;
}
.lookup-row-actions {
  justify-content: center;
  gap: 8px;
}
.lookup-row-actions .btn-tight {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 4px;
}
.lookup-checkbox {
  display: block;
  margin: 0;
}
.lookup-text-input {
  min-width: 140px;
}
.lookup-input-code {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  text-align: left;
}
.review-data-table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}
.review-data-table th,
.review-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.review-data-table th:nth-of-type(1),
.review-data-table td:nth-of-type(1) { width: 220px; min-width: 220px; max-width: 220px; }
.review-data-table th:nth-of-type(2),
.review-data-table td:nth-of-type(2) { width: 560px; min-width: 560px; max-width: 560px; }
.review-data-table th:nth-of-type(3),
.review-data-table td:nth-of-type(3) { width: 108px; min-width: 108px; max-width: 108px; }
.review-data-table th:nth-of-type(4),
.review-data-table td:nth-of-type(4) { width: 124px; min-width: 124px; max-width: 124px; }
.review-data-table th:nth-of-type(5),
.review-data-table td:nth-of-type(5),
.review-data-table th:nth-of-type(6),
.review-data-table td:nth-of-type(6),
.review-data-table th:nth-of-type(7),
.review-data-table td:nth-of-type(7) { width: 204px; min-width: 204px; max-width: 204px; }
.review-data-table th:nth-of-type(8),
.review-data-table td:nth-of-type(8) { width: 320px; min-width: 320px; max-width: 320px; }
.review-data-table th:nth-of-type(1),
.review-data-table td:nth-of-type(1),
.review-data-table th:nth-of-type(2),
.review-data-table td:nth-of-type(2) {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
/* Identity-based overrides win over positional widths so these columns stay
   stable even when the report column order changes. */
.review-data-table th.review-order-col,
.review-data-table td.review-order-col {
  width: 330px; min-width: 330px; max-width: 330px;
}
.review-data-table th.review-order-col {
  white-space: pre-line;
  line-height: 1.03;
}
.review-data-table th.review-host-col,
.review-data-table td.review-host-col {
  width: 204px; min-width: 204px; max-width: 204px;
  --editable-cell-width: 150px;
}
.review-data-table th:nth-of-type(1),
.review-data-table td:nth-of-type(1),
.review-data-table th.review-order-col,
.review-data-table td.review-order-col {
  position: sticky;
}
.review-data-table th:nth-of-type(1),
.review-data-table td:nth-of-type(1) {
  left: 0;
}
.review-data-table th.review-order-col,
.review-data-table td.review-order-col {
  left: 220px;
}
.review-data-table th:nth-of-type(1),
.review-data-table th.review-order-col {
  z-index: 35;
}
.review-data-table td:nth-of-type(1),
.review-data-table td.review-order-col {
  z-index: 15;
  background: var(--surface);
}
.review-data-table tbody tr.needs-review-row > td:nth-of-type(1),
.review-data-table tbody tr.needs-review-row > td.review-order-col {
  background: var(--review-wash);
}
.review-data-table tbody tr:hover > td:nth-of-type(1),
.review-data-table tbody tr:hover > td.review-order-col {
  background: var(--surface-warm);
}
.review-data-table tbody tr.needs-review-row:hover > td:nth-of-type(1),
.review-data-table tbody tr.needs-review-row:hover > td.review-order-col {
  background: var(--review-wash-hover);
}
.review-data-table th.review-order-col,
.review-data-table td.review-order-col {
  box-shadow: 1px 0 0 var(--border);
}
.report-data-table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}
.report-data-table th,
.report-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-data-table th.report-channel-col,
.report-data-table td.report-channel-col {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
}
.report-data-table th.review-order-col,
.report-data-table td.review-order-col {
  width: 330px;
  min-width: 330px;
  max-width: 330px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.report-data-table th.report-impressions-col,
.report-data-table td.report-impressions-col {
  width: 82px;
  min-width: 82px;
  max-width: 82px;
}
.report-data-table th.report-income-col,
.report-data-table td.report-income-col,
.report-data-table th.report-amount-col,
.report-data-table td.report-amount-col {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
}
.report-data-table th.report-cpm-col,
.report-data-table td.report-cpm-col {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
}
.report-data-table th.report-pddm-col,
.report-data-table td.report-pddm-col {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
}
.report-data-table th.report-category-col,
.report-data-table td.report-category-col {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
}
.data-table th.report-relation-col,
.data-table td.report-relation-col {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.order-regelitem-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  min-width: 0;
  line-height: 1.05;
}
.order-regelitem-main {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
}
.order-regelitem-order {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-warm);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-regelitem-info {
  flex: 0 0 auto;
  cursor: help;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1;
  user-select: none;
}
.order-regelitem-info:hover { color: var(--ink-mid); }
.order-regelitem-extra {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: 8px;
  color: var(--ink-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Rows needing classification review ──────────────────────────────────────
   Soft full-row wash + a left accent rail so the whole row reads as "needs
   attention" without the harsh per-cell red box. The specific cell(s) that
   must be set get a slightly stronger tint on top. */
.data-table tbody tr.needs-review-row > td { background: var(--review-wash); }
.data-table tbody tr.needs-review-row:hover > td { background: var(--review-wash-hover); }
.data-table tbody tr.needs-review-row > td:first-child {
  box-shadow: inset 3px 0 0 var(--review-accent);
}
.data-table tbody tr td.needs-review-cell,
.data-table tbody tr:hover td.needs-review-cell { background: var(--review-cell); }
.review-data-table td.needs-review-cell { overflow: visible; }
.cell-review-wrap { display: flex; align-items: center; gap: 4px; }
.cell-review-wrap > span {
  min-width: max-content;
}

.review-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr)) auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}
.review-filter-field {
  margin: 0;
  min-width: 0;
  width: auto;
}
.review-filter-label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-light);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.45px;
  line-height: 1;
  text-transform: uppercase;
}
.review-filter-field .cbx-control,
.review-filter-field .cbx-input {
  height: var(--control-height);
}
.review-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-mid);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.review-toggle:hover {
  border-color: var(--border-dark);
  background: var(--surface-warm);
}
.review-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--orange);
}
.review-filter-meta {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
  height: var(--control-height);
  min-width: 156px;
}
.review-row-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--ink-light);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.review-warning-notice span {
  white-space: pre-line;
}
.review-warning-card {
  display: grid;
  gap: 10px;
}
.review-warning-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.review-warning-table {
  width: min(760px, 100%);
  table-layout: fixed;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid rgba(186, 126, 0, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}
.review-warning-table th,
.review-warning-table td {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(186, 126, 0, 0.16);
  border-right: 1px solid rgba(186, 126, 0, 0.12);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.review-warning-table th:last-child,
.review-warning-table td:last-child {
  border-right: 0;
}
.review-warning-table tbody th {
  text-align: left;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: normal;
}
.review-warning-table th {
  color: var(--ink-light);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.review-warning-table tr:last-child td {
  border-bottom: 0;
}
.review-warning-table tr:last-child th {
  border-bottom: 0;
}
.review-warning-table th:last-child,
.review-warning-table td:last-child {
  background: rgba(255, 255, 255, 0.46);
  font-weight: 700;
}
.review-warning-hint {
  color: var(--ink-mid);
  font-size: 12px;
}
.review-warning-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.host-assistant-trigger {
  border-color: rgba(186, 126, 0, 0.34);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}
.host-assistant-trigger:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
}
.review-warning-neutral {
  color: var(--ink);
}
.review-warning-diff-ok {
  color: var(--green);
  font-weight: 700;
}
.review-warning-diff-bad {
  color: var(--red);
  font-weight: 700;
}

.host-assistant-modal {
  width: min(620px, 100%);
}
.host-assistant-warning-title {
  color: var(--amber);
}
.host-assistant-loading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 8px 0;
}
.host-assistant-loading .spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin-top: 2px;
}
.host-assistant-loading-label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.host-assistant-loading p,
.host-assistant-note {
  margin: 4px 0 0;
  color: var(--ink-mid);
  font-size: 12px;
  line-height: 1.5;
}
.host-assistant-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
}
.host-assistant-result.is-success {
  border-color: #a0d4b8;
  background: var(--green-pale);
  color: var(--green);
}
.host-assistant-result.is-warning {
  border-color: rgba(186, 126, 0, 0.34);
  background: var(--amber-pale);
  color: var(--amber);
}
.host-assistant-result-icon {
  font-weight: 800;
}
.host-assistant-groups {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.host-assistant-group {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
}
.host-assistant-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.host-assistant-group-head span {
  color: var(--ink-light);
}
.host-assistant-result.is-proposal,
.host-assistant-result.is-alternatives {
  background: var(--surface-warm);
}
.host-assistant-proposal,
.host-assistant-change {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.host-assistant-change {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.host-assistant-change > strong { color: var(--amber); font-size: 15px; }
fieldset.host-assistant-proposal { border: 0; padding: 0; min-width: 0; }
fieldset.host-assistant-proposal legend { font-size: 13px; font-weight: 700; }
fieldset.host-assistant-proposal label { cursor: pointer; margin-top: 0; }
fieldset.host-assistant-proposal input { width: auto; margin-right: 6px; }
.host-assistant-change small,
.host-assistant-lines small { display: block; color: var(--ink-mid); }
.host-assistant-comparison { width: 100%; border-collapse: collapse; font-size: 12px; }
.host-assistant-comparison caption { text-align: left; font-weight: 700; margin-bottom: 8px; }
.host-assistant-comparison th,
.host-assistant-comparison td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--border); }
.host-assistant-comparison th:first-child { text-align: left; }
.host-assistant-group > summary { cursor: pointer; }
.host-assistant-group > summary::after { content: '▸'; }
.host-assistant-group[open] > summary::after { content: '▾'; }
.host-assistant-lines { padding-left: 18px; font-size: 12px; overflow-wrap: anywhere; }
.host-assistant-lines li + li { margin-top: 10px; }

.review-info {
  flex-shrink: 0;
  cursor: help;
  color: var(--red);
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

/* Click-to-edit cells. Rendered to look exactly like the closed combobox
   (.cbx-sm .cbx-input + caret) so they read as dropdowns; the real combobox
   mounts in place on click with no size shift. Keeping them as static markup
   until clicked is what lets the full sheet render without the freeze that
   thousands of always-on comboboxes caused. */
.editable-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: var(--editable-cell-width);
  min-width: var(--editable-cell-width);
  max-width: var(--editable-cell-width);
  height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.editable-cell:hover {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,80,10,0.08);
}
/* Empty value reads as a placeholder, not a real selection. */
.editable-cell.is-empty { color: var(--ink-light); }

/* Dormant combobox: mounted but hidden behind the click overlay. */
.cbx-dormant { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; opacity: 0 !important; pointer-events: none !important; }

/* Overlay for dormant cells: looks like the old editable-cell but sits on top */
.editable-cell--overlay {
  position: relative;
  z-index: 1;
}
/* When editing (overlay hidden via x-show), un-dormant the combobox */
.cbx-sm:not(.cbx-dormant) + .editable-cell--overlay { display: none; }

/* Per-cell "this value is correct" tick, sits next to the ⓘ reason icon. */
.review-confirm {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1;
  user-select: none;
  transition: color 0.12s;
}
.review-confirm:hover { color: var(--success, #2a8a4a); }

.undo-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.undo-review-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

/* ── Review-reason tooltip ──────────────────────────────────────────────────
   Always in the DOM so coordinates are set before it becomes visible.
   Opacity-only transition avoids the position-flash that x-show causes. */
.review-tip {
  position: fixed;
  transform: translate(-50%, calc(-100% - 9px));
  z-index: 200;
  max-width: 380px;
  padding: 7px 10px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  white-space: normal;
  opacity: 0;
  transition: opacity 80ms;
}
.review-tip.is-visible { opacity: 1; }
.review-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.review-tip-order {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 4px;
}
.review-tip-text {
  white-space: pre-line;
}

/* ── Toast ── */
.yt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  translate: -50% 0;
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 5000;
  font-size: 13px;
}

/* ── Inline Row Editing Styles ── */

.data-table td input[type="text"].price-input,
.data-table td input[type="number"].price-input,
.data-table td select.price-input {
  height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.data-table td input[type="text"].price-input:focus,
.data-table td input[type="number"].price-input:focus,
.data-table td select.price-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(232,80,10,0.15);
  outline: none;
}

.data-table td input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--orange);
}

.data-table td select.price-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 24px;
}

.data-table td .lookup-percent-input-wrap {
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.data-table td input[type="text"].price-input.lookup-percent-input {
  width: 44px;
  height: 24px;
  padding: 2px 5px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-size: 12px;
}
.data-table td input[type="text"].price-input.lookup-percent-input:focus {
  border: 0;
  box-shadow: none;
}
.data-table td .lookup-percent-input-wrap:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(232,80,10,0.15);
}
.data-table td .lookup-percent-symbol {
  height: 24px;
  border-top: 0;
  border-bottom: 0;
  border-right: 0;
  background: transparent;
}

/* Right-align number/money columns in the Stap 1 / Stap 2 summary tables —
   width is left natural (unlike the dense Report Data .num-col/.int-col). */
.inv-table th.col-num,
.inv-table td.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

