/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Space Grotesk - Variable font for marketing headers
 * ss01 = single-story 'a' alternate (matches Inter's stylistic personality) */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  font-feature-settings: "ss01";
}

/* Inter - Variable font for body text */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  font-feature-settings: "cv11", "ss01";
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-variable-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
  font-feature-settings: "cv11", "ss01";
}

/* Force single-story 'a' on Space Grotesk wherever it's used.
 * @font-face font-feature-settings is honored inconsistently across browsers,
 * so apply at the utility level too. font-display utility maps to Space Grotesk. */
.font-display {
  font-feature-settings: "ss02";
}

/* Global focus-visible for custom interactive elements (Polaris handles its own) */
:focus-visible {
  outline: 2px solid var(--p-color-border-interactive-focus, #005bd3);
  outline-offset: 2px;
}

/* Product workbench visual polish (scoped to product show page) */
.product-workbench .Polaris-Card {
  border-radius: 12px;
}

.product-workbench {
  --pw-history-gutter: var(--p-space-400);
  --pw-history-status-width: 8.5rem;
}

.product-workbench .pw-section-label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--p-color-text-secondary);
  letter-spacing: 0.045em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.product-workbench .pw-mini-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--p-color-text-secondary);
  letter-spacing: 0.01em;
}

/* Score-summary layout: ScoreViz on the left, outcome copy on the right.
 * The visual weight of the score lives entirely inside ScoreViz now —
 * this wrapper is just the two-column scaffolding. */
.product-workbench .pw-score-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--p-space-500);
  align-items: start;
}

.product-workbench .pw-score-summary__viz {
  min-width: 0;
}

@media (max-width: 640px) {
  .product-workbench .pw-score-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

.product-workbench .pw-callout {
  border-left: 2px solid #d4a053;
  background: #fbf8f1;
  border-radius: 0 var(--p-border-radius-200) var(--p-border-radius-200) 0;
  padding: var(--p-space-150) var(--p-space-250);
  margin-top: var(--p-space-250);
  margin-bottom: var(--p-space-200);
}

.product-workbench .pw-callout-text {
  font-size: 12px;
  padding-left: var(--p-space-100);
}

.product-workbench .pw-callout-text strong {
  color: var(--p-color-text);
  font-weight: 600;
}

.product-workbench .pw-callout-dash {
  margin: 0 0.15em;
  color: var(--p-color-text-subdued);
}

.product-workbench .pw-fixes-compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--p-space-150);
  margin-top: var(--p-space-200);
}

.product-workbench .pw-next-improve {
  padding-top: var(--p-space-150);
}

.product-workbench .pw-fix-item {
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-150);
  background: var(--p-color-bg-surface, #fff);
  padding: 10px 12px;
}

.product-workbench .pw-fix-item--ranked {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--p-space-300);
}

.product-workbench .pw-fix-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--p-border-radius-full, 999px);
  background: var(--p-color-bg-surface-secondary, #f1f1f1);
  color: var(--p-color-text-subdued, #6d7175);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.product-workbench .pw-fix-main {
  min-width: 0;
}

.product-workbench .pw-fix-label {
  display: block;
  font-weight: 600;
  margin-bottom: 1px;
  font-size: 13px;
}

.product-workbench .pw-fix-tip {
  display: block;
  font-size: 11px;
  line-height: 1.35;
}

.product-workbench .pw-fix-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  width: 130px;
}

.product-workbench .pw-fix-score-num {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.product-workbench .pw-fix-score-bar {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: var(--p-border-radius-full, 999px);
  background: var(--p-color-bg-surface-secondary, #f1f1f1);
  overflow: hidden;
}

.product-workbench .pw-fix-score-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--p-color-bg-fill-secondary, #8a8a8a);
}

.product-workbench .pw-fix-score--success .pw-fix-score-num {
  color: var(--p-color-text-success, #0c5132);
}

.product-workbench .pw-fix-score--success .pw-fix-score-fill {
  background: var(--p-color-bg-fill-success, #29845a);
}

.product-workbench .pw-fix-score--warning .pw-fix-score-num {
  color: var(--p-color-text-caution, #8a6116);
}

.product-workbench .pw-fix-score--warning .pw-fix-score-fill {
  background: var(--p-color-bg-fill-caution, #ffc453);
}

.product-workbench .pw-fix-score--critical .pw-fix-score-num {
  color: var(--p-color-text-critical, #c5210a);
}

.product-workbench .pw-fix-score--critical .pw-fix-score-fill {
  background: var(--p-color-bg-fill-critical, #e0301e);
}

.product-workbench .pw-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  gap: var(--p-space-500);
  align-items: start;
  margin-top: var(--p-space-400);
}

.product-workbench .pw-product-detail-row {
  display: grid;
  grid-template-columns: minmax(104px, max-content) 1fr;
  column-gap: var(--p-space-300);
  align-items: baseline;
}

.product-workbench .pw-update-row {
  background: transparent;
  padding: var(--p-space-200) var(--p-space-400);
}

.product-workbench .pw-update-row + .pw-update-row {
  margin-top: var(--p-space-200);
}

.product-workbench .pw-update-shell {
  background: var(--p-color-bg, #fff);
}

.product-workbench .pw-update-head {
  min-width: 0;
  padding-bottom: var(--p-space-150);
  border-bottom: 1px solid var(--p-color-border-subdued, #dde0e4);
}

.pw-powered-by { font-weight: 400; }
.pw-powered-by-link {
  color: var(--p-color-text-subdued);
  text-decoration: none;
}
.pw-powered-by-link:hover {
  text-decoration: underline;
  color: var(--p-color-text-interactive);
}

.product-workbench .pw-update-diff {
  margin-top: var(--p-space-100);
}

.product-workbench .pw-update-diff--single {
  max-width: none;
}

.product-workbench .pw-update-pane {
  min-width: 0;
}

.product-workbench .pw-update-diff--single .pw-update-pane--proposed {
  width: 100%;
}

.product-workbench .pw-update-pane .pw-mini-label {
  margin-bottom: var(--p-space-050);
}

.product-workbench .pw-update-pane--proposed {
  border-inline-start-color: var(--p-color-border-success, #16a34a);
  box-shadow: var(--p-shadow-xs);
}

.product-workbench .pw-update-actions {
  min-height: 2rem;
}

.product-workbench .pw-update-actions form {
  margin: 0;
}

.product-workbench .pw-rich-copy {
  color: var(--p-color-text);
  line-height: 1.46;
}

.product-workbench .pw-rich-copy-wrap {
  margin-top: var(--p-space-050);
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.product-workbench .pw-rich-copy p {
  margin: 0 0 0.45rem 0;
}

.product-workbench .pw-rich-copy p:last-child {
  margin-bottom: 0;
}

.product-workbench .pw-rich-copy ul,
.product-workbench .pw-rich-copy ol {
  margin: 0.25rem 0 0.6rem 1.1rem;
  padding: 0;
}

.product-workbench .pw-rich-copy li {
  margin-bottom: 0.25rem;
}

.product-workbench .pw-rich-copy strong {
  font-weight: 650;
}

.product-workbench .pw-rich-copy--current {
  max-height: none;
}

.product-workbench .pw-rich-copy--proposed {
  max-height: none;
}

.product-workbench .pw-rich-copy-wrap--current {
  max-height: 12.5rem;
}

.product-workbench .pw-rich-copy-wrap--proposed {
  max-height: 13.5rem;
}

.product-workbench .pw-update-diff--single .pw-rich-copy {
  max-width: 78ch;
}

.product-workbench .pw-update-diff--single .pw-rich-copy-wrap--proposed {
  max-height: 14rem;
}

.product-workbench .pw-update-history-heading {
  padding: var(--p-space-300) var(--pw-history-gutter) 0;
}

.product-workbench .pw-update-history-list {
  padding: var(--p-space-150) 0 var(--p-space-300);
}

.product-workbench .pw-update-history-columns {
  padding: 0;
  margin-bottom: 0;
}

.product-workbench .pw-update-history-columns .pw-mini-label {
  margin-bottom: 0;
  white-space: nowrap;
  overflow: visible;
  display: inline;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--p-color-text-subdued, #6d7175);
}

.product-workbench .pw-update-history-columns .pw-update-history-content {
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  max-height: none;
}

.product-workbench .pw-update-history-columns .pw-update-history-status {
  min-width: 0;
}

.product-workbench .pw-update-history-columns .pw-update-history-status .Polaris-Badge {
  min-width: 0;
}

.product-workbench .pw-update-history-columns > .pw-update-history-status {
  justify-self: end;
}

.product-workbench .pw-update-history-row {
  padding: 0;
  border-top: 1px solid var(--p-color-border-secondary, #e1e3e5);
}

.product-workbench .pw-update-history-columns.pw-update-history-stack {
  padding: var(--p-space-100) var(--pw-history-gutter) var(--p-space-150);
}

.product-workbench .pw-update-history-row .pw-update-history-stack {
  padding: var(--p-space-200) var(--pw-history-gutter);
}

.product-workbench .pw-update-history-stack {
  display: grid;
  grid-template-columns: minmax(148px, 188px) minmax(0, 1fr) auto;
  column-gap: var(--p-space-300);
  row-gap: var(--p-space-050);
  align-items: start;
}

.product-workbench .pw-update-history-field {
  color: var(--p-color-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-workbench .pw-update-history-content {
  color: var(--p-color-text-secondary);
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.8em;
  max-width: 74ch;
}

.product-workbench .pw-update-history-status {
  display: flex;
  justify-content: flex-end;
  justify-self: end;
  min-width: var(--pw-history-status-width);
  align-self: start;
  text-align: right;
}

.product-workbench .pw-update-history-status .Polaris-Badge {
  min-width: var(--pw-history-status-width);
  padding-inline: var(--p-space-200);
  justify-content: center;
}

@media (max-width: 900px) {
  .product-workbench .pw-summary-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .product-workbench .pw-outcome-copy {
    max-width: none;
    text-align: left;
  }

  .product-workbench .pw-summary-metrics {
    justify-content: flex-start;
  }

  .product-workbench .pw-fixes-compact {
    grid-template-columns: 1fr;
  }

  .product-workbench .pw-panels {
    grid-template-columns: 1fr;
    gap: var(--p-space-400);
  }

  .product-workbench .pw-product-detail-row {
    grid-template-columns: minmax(96px, max-content) 1fr;
  }

  .product-workbench .pw-update-row {
    padding: var(--p-space-150) var(--p-space-200);
  }

  .product-workbench .pw-update-row + .pw-update-row {
    margin-top: var(--p-space-150);
  }

  .product-workbench .pw-update-history-list {
    padding: var(--p-space-100) var(--p-space-200) var(--p-space-150);
  }

  .product-workbench .pw-update-history-columns {
    display: none;
  }

  .product-workbench .pw-update-history-row {
    padding: 0;
  }

  .product-workbench .pw-update-history-stack {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--p-space-200);
    row-gap: var(--p-space-100);
    align-items: start;
  }

  .product-workbench .pw-update-history-row .pw-update-history-stack {
    padding: var(--p-space-150) 0;
  }

  .product-workbench .pw-update-history-field {
    grid-column: 1 / 2;
    white-space: normal;
  }

  .product-workbench .pw-update-history-content {
    grid-column: 1 / -1;
    max-width: none;
  }

  .product-workbench .pw-update-history-status {
    grid-column: 2 / 3;
    grid-row: 1;
    min-width: 0;
  }
}

/* Dashboard visual polish (scoped to dashboard page) */
.dashboard-workbench {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-400);
}

.dashboard-workbench .Polaris-Card {
  border-radius: 12px;
}

.dashboard-workbench .dw-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--p-color-text-secondary);
}

.dashboard-workbench .dw-priority {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--p-space-400);
}

.dashboard-workbench .dw-priority-copy {
  max-width: 720px;
}

.dashboard-workbench .dw-priority-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--p-space-200);
  flex-shrink: 0;
}

.dashboard-workbench .dw-progress-strip {
  border-top: 1px solid var(--p-color-border-secondary, #d2d5d8);
  padding-top: var(--p-space-200);
}

.dashboard-workbench .dw-progress-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-workbench .dw-progress-sep {
  color: var(--p-color-text-secondary);
}

.dashboard-workbench .dw-progress-strong {
  color: var(--p-color-text);
  font-weight: 600;
}

.dashboard-workbench .dw-queues-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--p-space-400);
  align-items: start;
}

.dashboard-workbench .dw-queues-grid > * {
  margin-top: 0 !important;
  align-self: start;
}

.dashboard-workbench .dw-queue-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--p-space-250);
}

.dashboard-workbench .dw-queue-title-wrap {
  min-width: 0;
}

.dashboard-workbench .dw-queue-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--p-space-150);
  flex-shrink: 0;
}

.dashboard-workbench .dw-card-link {
  flex-shrink: 0;
  white-space: nowrap;
}

.dashboard-workbench .dw-list-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--p-border-radius-200, 8px);
}

.dashboard-workbench .dw-list-link:hover {
  background: var(--p-color-bg-surface-hover);
}

.dashboard-workbench .dw-list-link:focus-visible {
  outline: 2px solid var(--p-color-border-focus);
  outline-offset: 2px;
}

.dashboard-workbench .dw-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--p-space-250);
  align-items: start;
}

.dashboard-workbench .dw-list-row--numbered {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.dashboard-workbench .dw-list-row__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-top: 1px;
  padding: 0 6px;
  border-radius: var(--p-border-radius-full, 999px);
  background: var(--p-color-bg-surface-secondary, #f1f1f1);
  color: var(--p-color-text-subdued, #6d7175);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dashboard-workbench .dw-list-main {
  min-width: 0;
}

.dashboard-workbench .dw-row-title {
  display: block;
  color: var(--p-color-text);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.7em;
}

.dashboard-workbench .dw-row-subtitle {
  display: block;
  line-height: 1.35;
  margin-top: 2px;
}

.dashboard-workbench .dw-row-meta {
  display: block;
  line-height: 1.25;
  margin-top: 1px;
  font-size: 12px;
}

.dashboard-workbench .dw-row-status,
.dashboard-workbench .dw-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  white-space: nowrap;
}

.dashboard-workbench .dw-empty {
  padding: var(--p-space-500) var(--p-space-200) var(--p-space-600);
}

.dashboard-workbench .dw-card-footer {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1060px) {
  .dashboard-workbench .dw-priority {
    flex-direction: column;
  }

  .dashboard-workbench .dw-priority-actions {
    justify-content: flex-start;
  }

  .dashboard-workbench .dw-queues-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-workbench .dw-card-link {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .dashboard-workbench .dw-priority-actions {
    flex-direction: column;
    width: 100%;
  }

  .dashboard-workbench .dw-queue-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-workbench .dw-queue-meta {
    width: 100%;
    justify-content: space-between;
  }
}

/* Welcome / onboarding banner — full-width lane matching .Polaris-Page
   (same left/right padding) so it stacks full-width above the page content
   instead of splitting into a narrow left column. */
.welcome-banner {
  width: 100%;
  box-sizing: border-box;
  padding: var(--p-space-400) var(--p-space-800) 0;
}

.welcome-banner .Polaris-Banner {
  width: 100%;
}

/* Softer, paler info wash to match the prototype (default Polaris info blue
   reads too saturated for a persistent onboarding banner). */
.welcome-banner .Polaris-Banner--statusInfo,
.welcome-banner .Polaris-Banner--withinPage.Polaris-Banner--statusInfo {
  background: #f2f7fe;
  border-color: #d6e4fb;
}

.welcome-banner__actions {
  display: flex;
  align-items: center;
  gap: var(--p-space-300);
  margin-top: var(--p-space-300);
  flex-wrap: wrap;
}

.welcome-banner__cta {
  text-decoration: none;
}

.welcome-banner__progress {
  display: inline-flex;
  align-items: center;
  gap: var(--p-space-150);
}

.welcome-banner__progress-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--p-color-bg-fill-success, #29845a);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
}

/* Billing visual polish (scoped to billing page) */
.billing-workbench {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-400);
}

.billing-workbench .Polaris-Card {
  border-radius: 12px;
}

.billing-workbench > * {
  margin-top: 0 !important;
}

.billing-workbench .Polaris-Card__Section,
.billing-workbench .Polaris-LegacyCard__Section {
  padding: 14px 16px;
}

.billing-workbench .bw-current-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--p-space-300);
}

.billing-workbench .bw-current-main {
  min-width: 0;
}

.billing-workbench .bw-current-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-workbench .bw-current-status {
  margin-top: var(--p-space-100);
}

.billing-workbench .bw-current-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: var(--p-space-150);
  min-width: 320px;
}

.billing-workbench .bw-meta-item {
  padding: 10px 12px;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  text-align: right;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.billing-workbench .bw-meta-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-workbench .bw-credit-strip {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-100);
}

.billing-workbench .bw-credit-bar {
  margin-top: 2px;
}

.billing-workbench .bw-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--p-space-100);
}

.billing-workbench .bw-kpi-item {
  padding: 10px 12px;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  min-height: 68px;
  display: flex;
  align-items: center;
}

.billing-workbench .bw-kpi-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-workbench .bw-section-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-workbench .bw-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--p-space-200);
  align-items: start;
}

.billing-workbench .bw-plan-card {
  position: relative;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-300, 12px);
  background: var(--p-color-bg-surface, #fff);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: var(--p-space-150);
}

.billing-workbench .bw-plan-card--current {
  border-color: #008060;
  background: #f6fef9;
}

.billing-workbench .bw-plan-card--popular {
  border-color: var(--p-color-border-interactive, #2c6ecb);
  box-shadow: 0 0 0 1px rgba(44, 110, 203, 0.15) inset;
  background: #fbfdff;
}

.billing-workbench .bw-plan-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 128px;
}

.billing-workbench .bw-plan-name-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--p-space-200);
  min-height: 28px;
}

.billing-workbench .bw-plan-badges {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.billing-workbench .bw-plan-price {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-height: 44px;
}

.billing-workbench .bw-plan-amount {
  font-size: 38px;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--p-color-text);
}

.billing-workbench .bw-plan-capacity {
  min-height: 20px;
}

.billing-workbench .bw-plan-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--p-color-border-secondary, #d2d5d8);
  padding-top: var(--p-space-100);
}

.billing-workbench .bw-plan-feature {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.billing-workbench .bw-plan-check {
  color: #008060;
  font-size: 14px;
  line-height: 1.45;
  margin-top: 1px;
  flex-shrink: 0;
}

.billing-workbench .bw-plan-feature--more .bw-plan-check {
  color: var(--p-color-text-secondary);
}

.billing-workbench .bw-plan-action {
  margin-top: var(--p-space-100);
}

.billing-workbench .bw-current-plan-note {
  padding: 9px 12px;
  border-radius: var(--p-border-radius-200, 8px);
  background: #e8f4ee;
  color: #00684a;
  text-align: center;
}

.billing-workbench .bw-history-empty {
  padding: var(--p-space-200) 0;
}

.billing-workbench .bw-history-amount {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1200px) {
  .billing-workbench .bw-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .billing-workbench .bw-current-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .billing-workbench .bw-current-meta-grid {
    min-width: 0;
    width: 100%;
  }

  .billing-workbench .bw-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .billing-workbench .bw-plan-grid {
    grid-template-columns: 1fr;
  }

  .billing-workbench .bw-plan-head,
  .billing-workbench .bw-plan-name-row,
  .billing-workbench .bw-plan-price,
  .billing-workbench .bw-plan-capacity {
    min-height: 0;
  }

  .billing-workbench .bw-plan-name-row {
    flex-direction: column;
    gap: var(--p-space-100);
  }

  .billing-workbench .bw-plan-badges {
    align-self: flex-start;
  }
}

@media (max-width: 640px) {
  .billing-workbench .bw-current-meta-grid {
    grid-template-columns: 1fr;
  }

  .billing-workbench .bw-meta-item {
    text-align: left;
    justify-content: flex-start;
  }

  .billing-workbench .bw-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Merchant shell and SaaS workbench primitives */
.merchant-shell {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-400);
  width: 100%;
}

.saas-workbench {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-400);
}

.saas-context-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--p-space-300);
  padding: var(--p-space-300);
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-300, 12px);
  background: var(--p-color-bg-surface, #fff);
}

.saas-context-bar__identity {
  min-width: 0;
}

.saas-context-bar__eyebrow,
.saas-summary-card__eyebrow {
  margin: 0 0 2px;
  color: var(--p-color-text-secondary);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.saas-context-bar__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--p-space-150);
}

.saas-context-bar__title,
.saas-summary-card__title {
  margin: 0;
  letter-spacing: -0.02em;
}

.saas-context-bar__title {
  font-size: 1.15rem;
  font-weight: 650;
}

.saas-context-bar__subtitle,
.saas-summary-card__body {
  margin: 4px 0 0;
  color: var(--p-color-text-secondary);
}

.saas-context-bar__role {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  color: var(--p-color-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.saas-context-bar__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--p-space-200);
}

.saas-context-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 10rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  color: inherit;
  text-decoration: none;
}

.saas-context-pill--link:hover {
  background: var(--p-color-bg-surface-hover);
}

.saas-context-pill--safe {
  border-color: rgba(0, 128, 96, 0.2);
}

.saas-context-pill--warning {
  border-color: rgba(183, 126, 36, 0.3);
}

.saas-context-pill--critical {
  border-color: rgba(216, 44, 13, 0.3);
}

.saas-context-pill__label,
.saas-summary-metric__label,
.bw-detail-item__label,
.saas-field__label,
.saas-detail-list__label,
.bw-plan-feature-block__label {
  color: var(--p-color-text-secondary);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.saas-context-pill__value,
.saas-summary-metric__value,
.bw-detail-item__value,
.saas-detail-list__value,
.bw-plan-feature-block__value {
  color: var(--p-color-text);
  font-weight: 600;
}

.saas-context-pill__detail,
.bw-detail-item__detail {
  color: var(--p-color-text-secondary);
  font-size: 12px;
}

.saas-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) auto;
  gap: var(--p-space-300);
  padding: var(--p-space-400);
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-300, 12px);
  background: linear-gradient(180deg, #fff, #fafafa);
}

.saas-summary-card__copy {
  min-width: 0;
}

.saas-summary-card__title {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  line-height: 1.1;
}

.saas-summary-card__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(8rem, 1fr));
  gap: var(--p-space-150);
  align-content: start;
}

.saas-summary-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: rgba(255, 255, 255, 0.85);
}

.saas-summary-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--p-space-200);
  grid-column: 1 / -1;
}

.saas-filter-head,
.bw-section-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.saas-filter-form,
.team-invite-form {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-300);
}

.saas-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--p-space-200);
}

.saas-filter-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.saas-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saas-field__input {
  min-height: 2.25rem;
  border: 1px solid var(--p-color-border-input, #8c9196);
  border-radius: var(--p-border-radius-150, 6px);
  background: var(--p-color-bg-surface, #fff);
  padding: 0.55rem 0.75rem;
  color: var(--p-color-text);
}

.saas-field__input:focus {
  outline: 2px solid rgba(0, 128, 96, 0.18);
  outline-offset: 1px;
}

.saas-filter-actions,
.settings-save-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--p-space-200);
}

.saas-table-main,
.saas-table-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.saas-tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--p-space-150);
  margin: var(--p-space-300) 0;
}

.saas-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: 999px;
  background: var(--p-color-bg-surface, #fff);
  color: inherit;
  text-decoration: none;
}

.saas-tab--active {
  border-color: rgba(0, 128, 96, 0.35);
  background: #f3fbf8;
}

.saas-tab__count {
  color: var(--p-color-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.saas-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--p-space-300);
  padding: var(--p-space-700) var(--p-space-400);
  text-align: center;
}

.saas-empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  color: var(--p-color-text-subdued, #8a8a8a);
}

.saas-empty-state__title {
  margin: 0;
}

.saas-empty-state__body {
  max-width: 36rem;
  margin: 0;
  color: var(--p-color-text-secondary);
}

.saas-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--p-space-150);
}

.saas-snapshot-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
}

.saas-snapshot-item__label {
  color: var(--p-color-text-secondary);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.saas-snapshot-item__value {
  color: var(--p-color-text);
  font-weight: 650;
}

.saas-snapshot-item__detail {
  color: var(--p-color-text-secondary);
  font-size: 12px;
}

.saas-detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-200);
}

.saas-detail-list__row {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--p-space-300);
  align-items: start;
}

.saas-detail-list__row--stacked {
  grid-template-columns: 1fr;
}

.saas-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--p-space-300);
}

.saas-rich-surface {
  min-height: 14rem;
  padding: var(--p-space-300);
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface, #fff);
  line-height: 1.55;
  overflow: auto;
}

.saas-rich-surface--highlight {
  background: #f7fbf9;
}

.settings-grid,
.team-invite-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr);
  gap: var(--p-space-300);
  align-items: start;
}

.settings-grid__main,
.settings-grid__side {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-300);
}

.settings-field-grid {
  display: grid;
  gap: var(--p-space-200);
}

.settings-choice {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
}

.settings-connection {
  display: flex;
  align-items: center;
  gap: var(--p-space-200);
}

.settings-connection__status {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: #008060;
  flex-shrink: 0;
}

.settings-connection__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--p-color-border-success, #008060);
  box-shadow: 0 0 0 3px rgba(41, 132, 90, 0.15);
  flex-shrink: 0;
}

.settings-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--p-space-100);
}

.settings-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  color: var(--p-color-text);
  font-size: 12px;
  font-weight: 600;
}

.settings-danger-row {
  margin-top: var(--p-space-300);
}

.team-role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--p-space-150);
  margin-top: var(--p-space-300);
}

.team-role-grid--stacked {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.team-role-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
}

.team-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--p-space-300);
}

.team-member-main {
  display: flex;
  align-items: center;
  gap: var(--p-space-250);
  min-width: 0;
}

.team-member-avatar {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  color: var(--p-color-text);
  font-weight: 650;
  flex-shrink: 0;
}

.team-member-avatar--pending {
  background: #fbf5ea;
}

.team-member-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-member-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--p-space-200);
  text-align: right;
}

.bw-inline-separator {
  margin: 0 0.35rem;
}

.bw-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 1fr);
  gap: var(--p-space-300);
  align-items: start;
}

.bw-overview-main,
.bw-notice-stack,
.bw-detail-grid,
.bw-credit-summary,
.bw-owner-actions,
.bw-owner-actions__copy,
.bw-credit-summary__head {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-200);
}

.bw-inline-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--p-space-150);
}

.bw-detail-grid {
  gap: var(--p-space-150);
}

.bw-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--p-color-border-secondary, #d2d5d8);
  border-radius: var(--p-border-radius-200, 8px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
}

.bw-credit-summary__head {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
}

.bw-plan-feature-grid {
  display: grid;
  gap: var(--p-space-100);
}

.bw-plan-feature-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.6rem 0.7rem;
  border-radius: var(--p-border-radius-150, 6px);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
}

.bw-owner-actions {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1100px) {
  .saas-summary-card,
  .bw-overview-grid,
  .settings-grid,
  .team-invite-grid,
  .saas-compare-grid {
    grid-template-columns: 1fr;
  }

  .saas-snapshot-grid,
  .team-role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saas-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .saas-context-bar {
    flex-direction: column;
  }

  .saas-context-bar__meta {
    width: 100%;
    justify-content: flex-start;
  }

  .saas-context-pill {
    min-width: min(100%, 14rem);
  }

  .saas-summary-card__metrics,
  .saas-snapshot-grid,
  .team-role-grid,
  .saas-filter-grid,
  .saas-filter-grid--3 {
    grid-template-columns: 1fr;
  }

  .team-member-row,
  .bw-owner-actions,
  .bw-credit-summary__head {
    flex-direction: column;
    align-items: flex-start;
  }

  .team-member-actions {
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .saas-summary-card,
  .saas-context-bar {
    padding: var(--p-space-300);
  }

  .saas-detail-list__row {
    grid-template-columns: 1fr;
    gap: var(--p-space-100);
  }
}

/* Polaris page header alignment fixes */
.Polaris-Page-Header__Row {
  align-items: center;
}

.Polaris-Page-Header__RightAlign {
  align-self: center;
}

/* ============================================================
   Shared shopify_app primitives (Task 1: polish punch list)
   All styles use Polaris tokens for color, spacing, and radius.
   Wrapper classes live on the ViewComponents themselves; the
   styles here are global because the components are reused on
   every screen.
   ============================================================ */

/* ---- ScoreViz: AI Readiness number + target-marked bar ---- */
.score-viz {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-150);
  min-width: 0;
}

.score-viz__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--p-space-200);
}

.score-viz__label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--p-color-text-secondary);
}

.score-viz__row {
  display: flex;
  align-items: baseline;
}

.score-viz__num {
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--p-color-text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.score-viz__pct {
  font-weight: 600;
  color: var(--p-color-text-secondary);
  margin-left: 2px;
}

.score-viz__bar {
  position: relative;
  width: 100%;
  background: var(--p-color-bg-fill-transparent-secondary, #e4e5e7);
  border-radius: 999px;
  overflow: visible;
}

.score-viz__bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}

.score-viz--success .score-viz__bar-fill { background: var(--p-color-bg-fill-success, #29845a); }
.score-viz--warning .score-viz__bar-fill { background: var(--p-color-bg-fill-warning, #d4a053); }
.score-viz--critical .score-viz__bar-fill { background: var(--p-color-bg-fill-critical, #e02b2b); }

.score-viz__target {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.score-viz__target-tick {
  display: block;
  width: 2px;
  height: 100%;
  background: var(--p-color-text);
  opacity: 0.55;
  border-radius: 1px;
}

.score-viz__legend {
  display: flex;
  justify-content: space-between;
  gap: var(--p-space-200);
  font-size: 11px;
  color: var(--p-color-text-secondary);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.score-viz--pulse .score-viz__num {
  animation: score-viz-pulse 1.6s ease-in-out infinite;
}

@keyframes score-viz-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .score-viz--pulse .score-viz__num { animation: none; }
  .score-viz__bar-fill { transition: none; }
}

/* ---- BeaconMark: the "B" wordmark ---- */
.beacon-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.beacon-mark svg { display: block; }

/* ---- PageHeader: title bar above every page ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--p-space-400);
  padding: var(--p-space-500) 0 var(--p-space-500);
  border-bottom: 1px solid var(--p-color-border-subdued, #e4e5e7);
  margin-bottom: var(--p-space-100);
}

.page-header__left {
  display: flex;
  align-items: flex-start;
  gap: var(--p-space-400);
  min-width: 0;
}

.page-header__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  flex-shrink: 0;
}

.page-header__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: var(--p-border-radius-200);
  color: var(--p-color-text-secondary);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  border: 1px solid var(--p-color-border-subdued, #e4e5e7);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.page-header__back:hover,
.page-header__back:focus-visible {
  background: var(--p-color-bg-surface, #fff);
  color: var(--p-color-text);
  border-color: var(--p-color-border, #c9cccf);
}

.page-header__copy { min-width: 0; flex: 1; }

.page-header__eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-color-text-secondary);
  margin-bottom: var(--p-space-100);
}

.page-header__breadcrumb { margin-bottom: var(--p-space-100); }
.page-header__breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--p-space-100);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--p-color-text-secondary);
}
.page-header__breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: var(--p-space-100);
}
.page-header__breadcrumb a {
  color: var(--p-color-text-secondary);
  text-decoration: none;
}
.page-header__breadcrumb a:hover { color: var(--p-color-text); text-decoration: underline; }
.page-header__breadcrumb-sep { color: var(--p-color-text-subdued); opacity: 0.65; }
.page-header__breadcrumb [aria-current="page"] { color: var(--p-color-text); font-weight: 500; }

.page-header__title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--p-color-text);
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
}

.page-header__meta {
  margin-top: var(--p-space-150);
  font-size: 13px;
  line-height: 1.5;
  color: var(--p-color-text-secondary);
  max-width: 64ch;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--p-space-200);
  flex-shrink: 0;
  margin-top: var(--p-space-200);
}

.page-header__action-form { display: inline-block; margin: 0; }

@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--p-space-300);
  }
  .page-header__left { gap: var(--p-space-300); }
  .page-header__title { font-size: 24px; }
  .page-header__actions { justify-content: flex-start; }
}

/* ============================================================
   Polish punch list — shared page layout primitives
   (Tasks 2/3/4/5/6/7: consistent vertical rhythm)
   ============================================================ */

/* The "stack-of-cards" rhythm: every embedded screen wraps its
   page content in .page-stack so card gaps are uniform. */
.page-stack {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-400);
}

.page-stack > * { min-width: 0; }

/* ---- KPI strip (3 or 4 equal columns of value + label) ---- */
.kpi-row {
  display: grid;
  gap: 0;
  align-items: stretch;
  background: var(--p-color-bg-surface, #fff);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 0 rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.kpi-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .kpi-row--3,
  .kpi-row--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .kpi-row--3,
  .kpi-row--4 { grid-template-columns: minmax(0, 1fr); }
}

.kpi-cell {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-150);
  padding: var(--p-space-400) var(--p-space-500) var(--p-space-300);
  border-right: 1px solid var(--p-color-border-subdued, #e4e5e7);
  background: var(--p-color-bg-surface, #fff);
  min-width: 0;
}

.kpi-cell:last-child { border-right: none; }

/* On wrap, the cells that fall to a new visual row need a top divider and the
   right-edge cell of each row should drop its divider. Handled per breakpoint. */
@media (max-width: 900px) {
  .kpi-row--4 .kpi-cell:nth-child(2n) { border-right: none; }
  .kpi-row--4 .kpi-cell:nth-child(n + 3),
  .kpi-row--3 .kpi-cell:nth-child(n + 3) { border-top: 1px solid var(--p-color-border-subdued, #e4e5e7); }
  .kpi-row--3 .kpi-cell:nth-child(2n) { border-right: none; }
}
@media (max-width: 560px) {
  .kpi-cell { border-right: none; }
  .kpi-cell:not(:first-child) { border-top: 1px solid var(--p-color-border-subdued, #e4e5e7); }
}

.kpi-cell__eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--p-color-text-secondary);
}

.kpi-cell__value {
  display: flex;
  align-items: baseline;
  gap: var(--p-space-100);
  flex-wrap: wrap;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--p-color-text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.kpi-cell__value-pct,
.kpi-cell__value-sub {
  font-size: 14px;
  font-weight: 500;
  color: var(--p-color-text-secondary);
}

.kpi-cell__label {
  font-size: 12px;
  color: var(--p-color-text-secondary);
}

/* ---- Segmented control (billing monthly/annual etc.) ---- */
.segmented {
  display: inline-flex;
  border: 1px solid var(--p-color-border-subdued, #e4e5e7);
  border-radius: var(--p-border-radius-200);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  padding: 2px;
}

.segmented__btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--p-color-text-secondary);
  padding: 6px 14px;
  border-radius: calc(var(--p-border-radius-200) - 2px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}

.segmented__btn:hover { color: var(--p-color-text); }

.segmented__btn.is-active {
  background: var(--p-color-bg-surface, #fff);
  color: var(--p-color-text);
  box-shadow: var(--p-shadow-100, 0 1px 0 rgba(0,0,0,0.05));
}

.segmented__save {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--p-color-text-success, #29845a);
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--p-color-bg-fill-success-secondary, #e7f5ec);
}

/* ---- Dashboard refinements ---- */
.dashboard-workbench .dw-queues-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--p-space-400);
}

@media (max-width: 900px) {
  .dashboard-workbench .dw-queues-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dw-queue-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--p-space-300);
}

.dw-queue-title-wrap { min-width: 0; }

.dw-list-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.dw-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--p-space-300);
  padding: var(--p-space-150) 0;
  border-top: 1px solid var(--p-color-border-subdued, #e4e5e7);
}

.dw-list-row:hover { background: var(--p-color-bg-surface-hover, #f6f6f7); }

.dw-list-main { min-width: 0; }
.dw-list-main > * { margin: 0; }

.dw-row-status,
.dw-score-badge { flex-shrink: 0; }

.dw-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--p-space-200);
  padding-top: var(--p-space-200);
  border-top: 1px solid var(--p-color-border-subdued, #e4e5e7);
}

.dw-empty {
  padding: var(--p-space-400) var(--p-space-400);
  text-align: center;
}

.dw-readiness-card {
  display: flex;
  gap: var(--p-space-500);
  align-items: stretch;
  flex-wrap: wrap;
}

.dw-readiness-card__viz { flex: 1 1 320px; min-width: 0; }
.dw-readiness-card__copy {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--p-space-200);
  justify-content: center;
}

.dw-priority-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--p-space-200);
  align-items: center;
}

/* ---- Products list refinements ---- */
.products-index-table .Polaris-IndexTable__TableCell { vertical-align: middle; }
.products-index-table .Polaris-IndexTable__TableCell--first { min-width: 240px; }

/* Refined column headers — uppercase, tracked, subdued (Shopify admin 2026 look) */
.products-index-table .Polaris-IndexTable__TableHeading,
.billing-workbench .Polaris-IndexTable__TableHeading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--p-color-text-secondary);
}

.products-handle {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", monospace;
  font-size: 12px;
  color: var(--p-color-text-secondary);
}

.products-row-actions {
  display: flex;
  gap: var(--p-space-200);
  justify-content: flex-end;
  align-items: center;
}

.products-row-score { display: inline-block; min-width: 110px; }

/* ---- Billing refinements ---- */
.bw-section-head {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-100);
}

.bw-section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--p-space-300);
  flex-wrap: wrap;
}

.bw-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--p-space-300);
}

@media (max-width: 1100px) { .bw-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .bw-plan-grid { grid-template-columns: minmax(0, 1fr); } }

.bw-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--p-space-300);
  padding: var(--p-space-400);
  border-radius: var(--p-border-radius-300);
  border: 1px solid var(--p-color-border-subdued, #e4e5e7);
  background: var(--p-color-bg-surface, #fff);
}

.bw-plan-card--popular {
  border-color: var(--p-color-border-emphasis, #1a1a1a);
  box-shadow: var(--p-shadow-200, 0 1px 2px rgba(0,0,0,0.05));
}

.bw-plan-card--current {
  border-color: var(--p-color-border-success, #29845a);
  background: var(--p-color-bg-surface-success-subdued, #f1f8f5);
}

.bw-plan-head {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-200);
}

.bw-plan-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--p-space-200);
}

.bw-plan-price {
  display: flex;
  align-items: baseline;
  gap: var(--p-space-100);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.bw-plan-amount {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--p-color-text);
}

.bw-plan-capacity {
  font-size: 13px;
  color: var(--p-color-text-secondary);
}

.bw-plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--p-space-150);
  flex: 1;
}

.bw-plan-feature {
  display: flex;
  gap: var(--p-space-150);
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.4;
  color: var(--p-color-text);
}

.bw-plan-check {
  color: var(--p-color-text-success, #29845a);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.bw-plan-feature--more .bw-plan-check { color: var(--p-color-text-secondary); }

.bw-plan-select-link { text-decoration: none; display: block; }
.bw-plan-action { margin-top: auto; }

.bw-current-plan-note {
  text-align: center;
  padding: 8px 0;
  color: var(--p-color-text-success, #29845a);
}

/* ---- Settings field stack (replaces hand-rolled inline gap divs) ---- */
.settings-field-stack {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-400);
}

.settings-field-stack--snug { gap: var(--p-space-300); }

/* ============================================================
   Embedded app layout shell (Task 2)
   Page padding: 20 top, 32 left/right, 40 bottom.
   Inter-card gap: handled by .page-stack (16px = --p-space-400).
   ============================================================ */
/* This layout reuses .Polaris-Frame as a plain wrapper (Shopify's <ui-nav-menu>
   provides chrome, not a Polaris nav). The gem's base rule is display:flex,
   which would lay the banner and the page out side-by-side as flex-row items.
   Force a vertical stack so banners sit above full-width page content.
   body > beats the gem's bare .Polaris-Frame on specificity. */
body > .Polaris-Frame {
  display: block;
}

/* Full-width lane. Views pass full_width: true so the gem applies
   .Polaris-Page--fullWidth (max-width: none); here we only set the page
   padding so the page edges line up with the welcome banner below. */
.Polaris-Frame .Polaris-Page {
  padding: var(--p-space-500) var(--p-space-800) var(--p-space-1000);
  width: 100%;
  box-sizing: border-box;
}

.Polaris-Page-Header { padding: var(--p-space-500) 0 var(--p-space-400); }
.Polaris-Header-Title { margin: 0; }
.Polaris-LegacyCard p { margin: 0; }

/* BFS mobile safe-area: keep content clear of the iOS bottom inset. */
body { padding-bottom: var(--shopify-safe-area-inset-bottom, 0); }

/* ============================================================
   Second polish pass — louder visual treatment
   ============================================================ */

/* ScoreViz tweaks: bigger weight, prominent target tick */
.score-viz__num {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.score-viz__bar {
  background: var(--p-color-bg-fill-transparent-secondary, #ebebeb);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.score-viz__target {
  top: -4px;
  bottom: -4px;
}

.score-viz__target-tick {
  width: 3px;
  background: var(--p-color-text);
  opacity: 0.85;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.score-viz--lg .score-viz__num,
.score-viz--md .score-viz__num {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

/* Status dot for badges (Polaris-like prefix dot) */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  vertical-align: middle;
}

/* AI tag: the "magic" treatment for AI-authored moments */
.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6535c9;
  background: linear-gradient(135deg, #f3edff 0%, #ece3ff 100%);
  border: 1px solid #d9c8ff;
  border-radius: 999px;
  padding: 3px 8px;
  line-height: 1;
}

.ai-tag svg { flex-shrink: 0; }

/* Card density modifiers (the snug/tight pattern from PROMPT §3.3) */
.polaris-card-snug .Polaris-LegacyCard__Section,
.card-snug .Polaris-LegacyCard__Section {
  padding: 14px 24px;
}

.polaris-card-tight .Polaris-LegacyCard__Section,
.card-tight .Polaris-LegacyCard__Section {
  padding: 10px 24px;
}

/* ---- Dashboard louder treatment ---- */
.dw-readiness-card {
  padding: var(--p-space-200) 0;
}

.dw-readiness-card__copy h3,
.dw-readiness-card__copy p {
  margin: 0;
}

/* KPI cell: subtle hover wash within the unified strip */
.kpi-cell {
  position: relative;
  transition: background 0.15s;
}

.kpi-cell:hover {
  background: var(--p-color-bg-surface-hover, #f6f6f7);
}

.kpi-cell__value {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.kpi-cell__delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 4px;
}

.kpi-cell__delta--up {
  color: var(--p-color-text-success, #29845a);
  background: var(--p-color-bg-fill-success-secondary, #e7f5ec);
}

.kpi-cell__delta--down {
  color: var(--p-color-text-critical, #e02b2b);
  background: var(--p-color-bg-fill-critical-secondary, #fce9e8);
}

/* Hover lift on list rows in queue cards */
.dw-list-row {
  transition: background 0.12s, transform 0.12s;
  border-radius: var(--p-border-radius-150);
  margin: 0 calc(-1 * var(--p-space-200));
  padding-left: var(--p-space-200);
  padding-right: var(--p-space-200);
}

.dw-list-row:hover {
  background: var(--p-color-bg-surface-hover, #f6f6f7);
}

/* The queue card header gets an explicit eyebrow + dividing rule */
.dw-queue-head {
  padding-bottom: var(--p-space-200);
  border-bottom: 1px solid var(--p-color-border-subdued, #e4e5e7);
  margin-bottom: var(--p-space-200);
}

/* Sparkline placeholder for the readiness card (visual scaffold only) */
.dw-sparkline {
  width: 100%;
  max-width: 220px;
  height: 40px;
  display: block;
  color: var(--p-color-text);
  opacity: 0.6;
}

/* ---- Products list louder treatment ---- */
.products-index-table .Polaris-IndexTable__TableRow {
  transition: background 0.12s;
}

.products-index-table .Polaris-IndexTable__TableRow:hover {
  background: var(--p-color-bg-surface-hover, #f6f6f7);
}

.products-row-score { display: inline-block; min-width: 130px; }

.products-handle {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", monospace;
  font-size: 11px;
  color: var(--p-color-text-secondary);
  background: var(--p-color-bg-surface-secondary, #f6f6f7);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 4px;
}

/* ---- Billing louder plan cards ---- */
.bw-plan-card {
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.bw-plan-card:hover {
  border-color: var(--p-color-border, #c9cccf);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.bw-plan-card--popular {
  border-width: 2px;
  border-color: var(--p-color-border-emphasis, #1a1a1a);
}

.bw-plan-card--popular::before {
  content: "Recommended";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--p-color-bg-fill-emphasis, #1a1a1a);
  padding: 4px 10px;
  border-radius: 999px;
}

.bw-plan-amount {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.028em;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .bw-plan-card:hover,
  .kpi-cell:hover,
  .dw-list-row:hover { transform: none; }
}
