/* Polaris web components style almost everything; this is only the big
   numbers on the variant page's cards. Colors are Polaris's text tones. */
.metric-value {
  font-size: 1.75rem;
  line-height: 1.15;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--p-color-text, #303030);
}
.metric-small { font-size: 1.1rem; line-height: 1.4; }

/* Costs table: thumbnail beside the title, however long the title. */
.product-cell { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }

 /* Costs page, edit mode: a plain table with native fields, in Polaris's colors. */
.edit-table-wrap { background: #fff; border: 1px solid #e3e3e3; border-radius: 12px; overflow-x: auto; }
.edit-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; color: #303030; }
.edit-table th { text-align: left; font-weight: 550; color: #616161; padding: 8px 10px; white-space: nowrap; }
.edit-table td { padding: 8px 10px; border-top: 1px solid #ebebeb; vertical-align: top; }
.edit-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.edit-table .sel-cell { width: 28px; padding-right: 0; }
.cell-cost, .cell-select, [data-bulk-value], [data-bulk-field] {
  font: inherit; color: inherit; height: 32px; padding: 0 8px; background: #fff;
  border: 1px solid #8a8a8a; border-radius: 8px; box-sizing: border-box;
}
.cell-cost { width: 104px; font-variant-numeric: tabular-nums; }
.cell-select { width: 76px; }
.cell-cost:focus, .cell-select:focus, [data-bulk-value]:focus, [data-bulk-field]:focus { outline: 2px solid #005bd3; outline-offset: 1px; }
.cell-cost.invalid, .cell-select.invalid { border-color: #c70a24; background: #fff5f5; }
.field-error { display: block; color: #c70a24; font-size: 0.75rem; margin-top: 4px; }
.link { background: none; border: 0; padding: 0; margin-top: 4px; display: block; font: inherit; font-size: 0.75rem; color: #005bd3; cursor: pointer; text-align: left; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: #eaf4ff; border: 1px solid #b4d6fa; border-radius: 12px; padding: 8px 12px; font-size: 0.8125rem; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .link { display: inline; margin: 0; font-size: 0.8125rem; }
.bulk-bar .bulk-set { display: inline-flex; align-items: center; gap: 6px; }
.bulk-bar .field-error { margin: 0; }
.sel { width: 18px; height: 18px; padding: 0; border: 1.5px solid #8a8a8a; border-radius: 5px; background: #fff; cursor: pointer; vertical-align: middle; }
.sel[aria-checked="true"] { background: #005bd3; border-color: #005bd3; box-shadow: inset 0 0 0 3px #fff; }
.sel[aria-checked="mixed"] { background: #005bd3; border-color: #005bd3; box-shadow: inset 0 0 0 6px #fff; }
.sel:focus-visible { outline: 2px solid #005bd3; outline-offset: 2px; }

/* Public pages (privacy policy). */
.legal { max-width: 720px; margin: 0 auto; padding: 48px 20px 64px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #303030; line-height: 1.6; }
.legal h1 { font-size: 1.75rem; margin: 16px 0 4px; }
.legal h2 { font-size: 1.15rem; margin-top: 32px; }
.legal .muted { color: #616161; margin-top: 0; }
.legal a { color: #005bd3; }

/* Exchange rates charts (ExchangeRate::Chart, ExchangeRate::ChangeBars). Tokens from the dataviz
   reference palette; light only, since the Shopify admin around the app stays
   light whatever the OS setting. */
.viz {
  --surface-1: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --series-1: #2a78d6;
  --diverging-down: #2a78d6;
  --diverging-up: #e34948;
  position: relative;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .gridline { stroke: var(--grid); stroke-width: 1; }
.viz .baseline { stroke: var(--baseline); stroke-width: 1; }
.viz .tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz .series { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .series-dot, .viz .crosshair-dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.viz .end-label { fill: var(--text-primary); font-size: 12px; font-weight: 600; }
.viz .average { stroke: var(--text-secondary); stroke-width: 1; }
.viz .average-label { fill: var(--text-secondary); font-size: 11px; }
.viz .crosshair { stroke: var(--text-muted); stroke-width: 1; }
.viz .hit { fill: transparent; cursor: crosshair; }
.viz .category { fill: var(--text-primary); font-size: 12px; font-weight: 600; }
.viz .tip-label { fill: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.viz .bar-up .bar-fill { fill: var(--diverging-up); }
.viz .bar-down .bar-fill { fill: var(--diverging-down); }
.viz .bar .hit { cursor: default; }
.viz .bar:hover .bar-fill, .viz .bar:focus .bar-fill { opacity: 0.8; }
.viz .bar:focus { outline: none; }
.viz .bar:focus-visible .category { text-decoration: underline; }
.viz-tooltip {
  position: absolute; pointer-events: none; z-index: 1;
  background: var(--surface-1); border: 1px solid rgba(11, 11, 11, 0.10); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); padding: 6px 10px; font-size: 12px; white-space: nowrap;
}
.viz-tooltip strong { display: block; color: var(--text-primary); font-size: 13px; }
.viz-tooltip span { color: var(--text-secondary); }

/* Stat tiles above each rate chart. */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { border: 1px solid rgba(11, 11, 11, 0.10); border-radius: 8px; padding: 10px 12px; }
.stat-label { color: #52514e; font-size: 12px; }
.stat-value { color: #0b0b0b; font-size: 1.35rem; font-weight: 600; line-height: 1.3; }
.stat-detail { color: #898781; font-size: 12px; min-height: 1.2em; }
.delta-bad { color: #d03b3b; }
.delta-good { color: #006300; }

/* The table view of a chart. */
.viz-table summary { cursor: pointer; color: #52514e; font-size: 13px; }
.viz-table table { border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.viz-table th, .viz-table td { text-align: left; padding: 4px 16px 4px 0; border-bottom: 1px solid #e1e0d9; }
.viz-table td:last-child { font-variant-numeric: tabular-nums; }
.viz-table p { color: #52514e; font-size: 13px; }

/* Setup guide on the Costs page. */
.guide { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.guide-step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.guide-mark {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #303030; background: #f1f1f1;
}
.guide-step.is-done .guide-mark { color: #fff; background: #29845a; }
.guide-step.is-done .guide-title { color: #616161; text-decoration: line-through; }
.guide-title { font-weight: 600; }
.guide-detail { color: #616161; margin: 2px 0 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The worked example: supplier cost × rate = Cost per item. */
.example { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.example strong { font-size: 1.05rem; }
.example-op { color: #616161; font-size: 1.2rem; }

/* Help page lists. */
.help-steps, .help-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }

/* Welcome sequence. */
.welcome { max-width: 640px; margin: 0 auto; display: grid; gap: 12px; }
.welcome-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.welcome-progress span { height: 4px; border-radius: 2px; background: #e3e3e3; }
.welcome-progress span.is-on { background: #303030; }
.welcome-points { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.welcome-costs { display: grid; gap: 12px; }
.welcome-cost-row { display: grid; grid-template-columns: 1fr minmax(160px, 220px); gap: 12px; align-items: end; }
.welcome-cost-title { font-weight: 600; }
@media (max-width: 520px) { .welcome-cost-row { grid-template-columns: 1fr; } }

/* "About this page" panel (shared/_about). */
.about { background: #fff; border: 1px solid #e3e3e3; border-radius: 12px; padding: 10px 14px; font-size: 13px; color: #303030; }
.about summary { cursor: pointer; color: #616161; }
.about-label { font-weight: 600; color: #303030; margin-right: 4px; }
.about dl { margin: 10px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.about dt { font-weight: 600; }
.about dd { margin: 0; color: #4a4a4a; }
.about-more { margin: 10px 0 0; }
@media (max-width: 520px) { .about dl { grid-template-columns: 1fr; } .about dd { margin-bottom: 6px; } }

/* Form rows: columns that can shrink (min-width 0), so a long field never
   spills into its neighbour; one column on phones. */
.form-grid { display: grid; gap: 12px 16px; }
.form-grid > * { min-width: 0; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid-2, .form-grid-3 { grid-template-columns: minmax(0, 1fr); } }
.form-notes { margin: 0; padding-left: 18px; color: #616161; font-size: 13px; display: grid; gap: 4px; }
