:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d7dde4;
  --accent: #b32025;
  --accent-dark: #8f181d;
  --soft: #f7f8fa;
  --shadow: 0 10px 30px rgba(31, 41, 51, 0.10);
}

* { box-sizing: border-box; }

html,
body {
  min-width: 1000px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(179, 32, 37, 0.08), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

.page {
  width: min(1200px, calc(100% - 48px));
  min-width: 950px;
  margin: 0 auto;
  padding: 24px 0 36px;
}

header { margin-bottom: 16px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.08;
}

.product-picker {
  margin-bottom: 14px;
}

.product-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.product-button {
  position: relative;
  display: grid;
  grid-template-rows: 108px auto;
  min-height: 160px;
  padding: 8px 10px 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(31, 41, 51, 0.06);
}

.product-button:hover {
  border-color: #aab3bd;
  background: #fcfcfd;
}

.product-button:focus-visible {
  outline: 4px solid rgba(179, 32, 37, 0.22);
  outline-offset: 2px;
}

.product-button.is-selected {
  border-color: var(--accent);
  background: #fff7f7;
  box-shadow: 0 8px 22px rgba(179, 32, 37, 0.16);
}

.product-button.is-selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  display:grid;
  place-items:center;
  padding:0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.product-image-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
}

.product-image {
  display: block;
  max-width: 100%;
  max-height: 104px;
  object-fit: contain;
}

.product-brand {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-name {
  display: block;
  margin-top: 3px;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.15;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.controls {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbfbfc);
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 750;
}

.color-combobox {
  position: relative;
  min-width: 0;
}

#colorSearch {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #bfc7d1;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
}

#colorSearch:focus {
  outline: 3px solid rgba(179, 32, 37, 0.18);
  border-color: var(--accent);
}

.color-results {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #bfc7d1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 41, 51, 0.18);
}

.color-results.is-open {
  display: block;
}

.color-option {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.color-option:last-child {
  border-bottom: 0;
}

.color-option:hover,
.color-option.is-active {
  background: #f6e9ea;
}

.color-no-results {
  padding: 12px;
  color: var(--muted);
  font-weight: 700;
}

.color-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: stretch;
}

.print-button {
  display: grid;
  place-items: center;
  min-width: 52px;
  min-height: 50px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.print-button svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.print-button:hover { background: var(--accent-dark); }
.print-button:focus { outline: 3px solid rgba(179, 32, 37, 0.22); }

.result { padding: 18px; }

.result-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.color-name {
  margin: 0;
  font-size: 1.55rem;
}

.base-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.formula-grid {
  display: grid;
  gap: 7px;
}

.formula-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
}

.code {
  align-self: stretch;
  display: grid;
  place-items: center;
  background: #eceff3;
  border-right: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.amount {
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.loading,
.error {
  padding: 18px;
  color: var(--muted);
  font-weight: 700;
}

.error { color: var(--accent); }

/* Hidden on-screen print label */
#printLabel {
  display: none;
}

/*
 * KNOWN-GOOD PRINT CSS
 * Preserved from PRINTING_REFERENCE_DO_NOT_EDIT.html.
 */
@page {
  size: 3.25in 2in;
  margin: 0;
}

@media print {
  html, body {
    width: 3.25in;
    height: 2in;
    margin: 0;
    padding: 0;
    background: white;
  }

  .page {
    display: none !important;
  }

  #printLabel {
    display: block;
    width: 3.25in;
    height: 2in;
    padding: 0.14in 0.18in 0.14in 0.34in;
    overflow: hidden;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
  }

  .label-inner {
    width: 100%;
    height: 100%;
    transform: translateX(-0.30in) rotate(180deg);
    transform-origin: center center;

    margin-left: 0.12in;
    width: calc(100% - 0.12in);
  }

  .label-store {
    font-size: 10pt;
    font-weight: 400;
    line-height: 1.0;
  }

  .label-phone,
  .label-nonreturn,
  .label-color,
  .label-brand,
  .label-date {
    font-size: 9pt;
    font-weight: 400;
    line-height: 1.0;
  }

  .label-color {
    font-weight: 800;
    margin-top: 0.03in;
  }

  .label-date {
    margin-top: 0.015in;
  }

  .label-base {
    margin-top: 0.025in;
    padding-bottom: 0.04in;
    border-bottom: 2px solid #000;
    font-size: 12pt;
    font-weight: 900;
    text-transform: uppercase;
  }

  .label-formula {
    margin-top: 0.015in;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.18in;
    row-gap: 0.005in;
  }

  .label-formula-column {
    display: grid;
    gap: 0.005in;
    align-content: start;
  }

  .label-formula-row {
    display: grid;
    grid-template-columns: 0.34in 1fr;
    font-size: 10pt;
    font-weight: 400;
    line-height: 1.0;
    font-variant-numeric: tabular-nums;
  }
}


.amount {
  font-family: Consolas, "Courier New", monospace;
  white-space: pre;
}

.label-formula-row {
  white-space: pre;
}
