/* Runtime controls adapted to the supplied visual system. */
button, input, select, summary { font: inherit; border-radius: 0; }
button, summary { cursor: pointer; }
button, select, input[type="date"], input[type="number"], #state-label {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 8px 12px;
}
button:disabled, input:disabled { cursor: not-allowed; }
button:disabled { background: var(--fill); color: var(--muted); border-color: var(--line); }
.primary {
  display: inline-flex; justify-content: center; align-items: center; gap: 10px;
  min-height: 46px; padding: 10px 18px; background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink); font-size: 14.5px; font-weight: 500;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-hover) ease, color var(--dur-hover) ease;
}
.primary:not(:disabled)::after { content: "→"; font-family: var(--mono); }
.primary:not(:disabled):active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled), #state-label:hover { border-color: var(--ink); }
  .primary:hover:not(:disabled) { background: var(--accent); color: var(--ink); }
}
.banner { padding: 9px var(--gutter); background: #fff7d9; border-bottom: 1px solid #ecdfb2; font-size: 12px; text-align: center; }
.banner strong { margin-right: 12px; }
.production-notice { background: var(--accent-soft); border-color: var(--line); }
.nav-auth { min-width: 0; font-size: 12px; }
.nav-auth .nav-login, .nav-auth .nav-signup { display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0 14px; }
.nav-auth .nav-login { background: none; color: var(--muted); }
.nav-auth .nav-signup { background: var(--ink); color: var(--bg); }
#auth-status { max-width: 240px; overflow-wrap: anywhere; line-height: 1.35; }
#auth-status:empty { display: none; }
.section-title { font-size: clamp(26px, 3vw, 36px); letter-spacing: -.035em; line-height: 1.1; margin-bottom: 32px; }
.filters > label, .date-range label { display: flex; flex-direction: column; gap: 8px; }
.filters > label, .label, legend { font: 11px var(--mono); text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.label, legend { display: block; margin-bottom: 8px; }
.filters select, #state-label {
  height: 38px; min-width: 190px; padding-right: 42px;
  font: 14px/20px var(--sans); letter-spacing: normal; text-transform: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231c1d20' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px;
}
.date-range { display: flex; flex-wrap: wrap; gap: 12px; }
.date-range input { min-width: 0; max-width: 180px; min-height: 38px; }
fieldset { border: 0; padding: 0; margin: 0; }
#states { position: relative; min-width: 190px; }
#state-label { width: 260px; max-width: 100%; list-style: none; white-space: nowrap; }
#state-label::-webkit-details-marker { display: none; }
.state-options { position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 300px; overflow-y: auto; z-index: 32; background: var(--surface); border: 1px solid var(--ink); padding: 6px; box-shadow: 0 18px 40px -18px #1c1d2047; }
.state-options label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.state-options label:hover { background: var(--fill); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
.contact-options { display: flex; }
.contact-options label { position: relative; display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-2); cursor: pointer; font-size: 14px; }
.contact-options label + label { border-left: 0; }
.contact-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.contact-options label:has(:checked) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.contact-options label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
#preset { width: 280px; }
.factoring-filter label { display: inline-flex; align-items: center; gap: 10px; min-height: 38px; cursor: pointer; font: 14px/20px var(--sans); }
.factoring-filter input { width: 16px; height: 16px; margin: 0; flex-shrink: 0; }
.preview, .rail { min-width: 0; }
.preview { border: 1px solid var(--line); background: var(--surface); }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.table-toolbar span { font: 10.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#fields-toggle { font-size: 12px; padding: 6px 10px; flex-shrink: 0; }
#fields { padding: 24px; border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.fields-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.fields-heading h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
#fields-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-color: transparent; background: transparent; }
.field-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; }
.field-groups h4 { margin: 0 0 10px; font: 11px/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field-groups ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.field-groups li { max-width: 100%; padding: 3px 7px; border: 1px solid var(--line); background: var(--surface); font: 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.field-groups code { font: inherit; }
@media (max-width: 600px) {
  #fields { padding: 18px; }
  .field-groups { grid-template-columns: 1fr; gap: 22px; }
}
.preview-table { position: relative; }
.table-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
#shop tbody tr { height: 64px; }
#shop .blur { display: inline-block; }
#shop td.wrap { overflow-wrap: anywhere; }
#shop tr:not(.gated) td:nth-child(1), #shop tr:not(.gated) td:nth-child(8) { white-space: normal; overflow-wrap: anywhere; }
.preview-table .sample-overlay { z-index: 1; }
.preview-table .sample-overlay button { max-width: calc(100% - 32px); }
.rail { display: flex; flex-direction: column; }
.rail hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
#exclusions { font-size: 12px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.volume { font-size: 46px; line-height: 1; font-weight: 500; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
#channel-label { color: var(--muted); font: 12px var(--mono); margin-top: 6px; }
.qty-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 12px; font-size: 12px; }
#qty { min-width: 0; width: 104px; font-variant-numeric: tabular-nums; }
#qty[aria-invalid="true"] { border-color: #932711; outline-color: #932711; }
.qty-feedback { color: #932711; font-size: 12px; line-height: 1.5; }
#qty-error:not(:empty) { margin-bottom: 4px; }
#qty-use-max {
  min-height: 36px; padding: 4px 0; margin-bottom: 12px; border: 0;
  background: none; color: inherit; font-size: 12px;
  text-decoration: underline; text-underline-offset: 3px;
}
#qty-range { width: 100%; margin-bottom: 20px; }
#rate { color: var(--muted); font: 12px var(--mono); }
.total { font-size: 30px; font-weight: 500; letter-spacing: -.045em; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
#minimum, .muted { font-size: 12px; line-height: 1.5; color: var(--muted); }
.muted { margin-top: 14px; }
.checkout-consent, #sample-fields .sample-consent { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; margin: 16px 0; font-size: 12px; line-height: 1.5; }
.checkout-consent input, .sample-consent input { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.checkout-consent a, #sample-dialog a { text-decoration: underline; text-underline-offset: 2px; }
.checkout-consent.consent-invalid { color: #932711; animation: consent-shake 320ms ease-out; }
.consent-invalid input { outline: 1px solid #932711; outline-offset: 2px; }
.consent-error { color: #932711; font-size: 12px; line-height: 1.5; margin: -6px 0 14px; }
@keyframes consent-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .checkout-consent.consent-invalid { animation: none; }
}
.notice { padding: 24px; border: 1px solid var(--ink); background: var(--accent-soft); margin-bottom: 32px; }
.notice h1, .notice h2 { margin-bottom: 12px; font-size: 26px; letter-spacing: -.03em; }
.notice p { margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.error { padding: 14px; margin-bottom: 16px; border: 1px solid #e7aaa0; background: #fff0ed; color: #932711; }
dialog { color: var(--ink); background: var(--surface); width: min(480px, calc(100% - 40px)); max-height: calc(100dvh - 48px); padding: 24px; margin: auto; border: 1px solid var(--ink); box-shadow: var(--sheet); overflow-y: auto; }
dialog::backdrop { background: #fdfdfdb3; backdrop-filter: blur(6px); }
.sample-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.sample-heading h2 { font-size: 22px; font-weight: 500; letter-spacing: -.03em; }
.sample-heading button { border: 0; font-size: 24px; padding: 0; width: 36px; height: 36px; }
#sample-dialog > p { color: var(--ink-2); font-size: 14px; }
#sample-form { margin-top: 20px; }
#sample-fields > label { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 14px 0; font-size: 13px; }
#sample-fields input:not([type="checkbox"]) { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line-2); background: var(--surface); }
#sample-fields .sample-trap { position: absolute; left: -10000px; }
#sample-submit { width: 100%; margin-top: 14px; }
#sample-status { font-size: 13px; margin-top: 12px; overflow-wrap: anywhere; }
@media (max-width: 1040px) {
  .rail { position: static; }
  .site-header .bar { height: auto; min-height: 60px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 12px; }
  .nav-auth { margin-left: auto; }
}
@media (max-width: 600px) {
  .banner strong { display: block; margin: 0; }
  .table-toolbar { flex-wrap: wrap; }
  .filters { gap: 18px; }
  .filters > label, .filters > div, .contact-options { width: 100%; }
  .filters select, #state-label { width: 100%; max-width: none; }
  #preset { width: 100%; }
  .contact-options label { flex: 1; justify-content: center; }
  .sample { padding: 32px 18px; }
  #auth-status { max-width: 185px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .primary:not(:disabled):active { transform: none; }
  .hero-copy > *, .hero-inner > * { animation: none; }
}

/* Promo controls share the storefront's typography, borders and restrained accent. */
.promo { margin: 20px 0 4px; font-size: 12px; }
.promo .promo-link { border: 0; background: transparent; padding: 4px 0; min-height: 28px; font: inherit; color: var(--ink-2); text-align: left; }
.promo-entry { display: flex; align-items: stretch; gap: 8px; }
#promo-code { width: 0; flex: 1; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px dashed var(--line-2); font: 12px var(--mono); text-transform: uppercase; }
#promo-code::placeholder { color: var(--muted); letter-spacing: .12em; opacity: 1; }
#promo-apply { min-height: 42px; padding: 10px 12px; font-size: 12px; }
.promo-applied { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); background: var(--accent-soft); }
#promo-name { font: 11px var(--mono); overflow-wrap: anywhere; min-width: 0; color: var(--accent-ink); }
#promo-remove { flex-shrink: 0; text-decoration: underline; text-underline-offset: 3px; }
.promo-message { margin-top: 8px; line-height: 1.5; color: #932711; }
#promo-code[aria-invalid="true"] { border-color: #932711; }
.promo-breakdown { margin-top: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.promo-breakdown > div { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; }
.promo-savings { color: var(--accent-ink); }

/* Purchase history shares the storefront's typography, borders and violet surfaces. */
#orders-page { display: none; width: min(100%, var(--wrap)); margin: 0 auto; padding: 56px var(--gutter) 80px; min-height: 70vh; }
html[data-view="orders"] #orders-page { display: block; }
html[data-view="orders"] [data-storefront] { display: none !important; }
#orders-back { display: inline-block; margin-bottom: 28px; font-size: 13px; color: var(--muted); }
#orders-back:hover { color: var(--ink); }
#orders-title:focus { outline: none; }
.history-heading { margin: 0; }
.history-heading h1 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -.035em; line-height: 1.15; }
#orders-description { margin: 12px 0 28px; max-width: 560px; color: var(--muted); font-size: 14px; line-height: 1.6; }
#orders-message { font-size: 14px; color: var(--ink-2); }
#orders-message:empty { display: none; }
#orders-signin { margin-top: 20px; }
#orders-list, #orders-skeleton { display: grid; gap: 16px; }
#orders-list:not(:empty) + #orders-skeleton { margin-top: 16px; }
#orders-skeleton.is-more .history-placeholder:not(:first-child) { display: none; }
.history-placeholder .history-order-body { min-height: 168px; }
.skeleton-line { display: block; height: 12px; width: min(100%, 330px); background: var(--line); animation: history-pulse 1.4s ease-in-out infinite alternate; }
.history-placeholder .history-details { display: flex; flex-direction: column; gap: 16px; }
.skeleton-short { width: 180px; max-width: 70%; }
.skeleton-title { width: 230px; height: 22px; margin-bottom: 4px; }
.skeleton-price { width: 100px; height: 30px; }
.skeleton-button { width: 156px; height: 46px; }
@keyframes history-pulse { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } }
.history-order { border: 1px solid var(--line-2); background: var(--bg); }
.history-order-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.history-reference { font: 11px/1.6 var(--mono); color: var(--ink-2); }
.history-badge { display: inline-flex; align-items: center; gap: 7px; font: 10px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.history-badge.is-paid { color: var(--ink); }
.history-badge.is-paid::before { content: ''; width: 6px; height: 6px; background: var(--accent); }
.history-order-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 20px; }
.history-details h3 { font-size: 19px; font-weight: 500; letter-spacing: -.02em; margin-bottom: 12px; }
.history-details p { font-size: 12px; color: var(--muted); line-height: 1.7; }
.history-order-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.history-amount { font-size: 26px; letter-spacing: -.04em; line-height: 1.2; }
.history-download-message { font-size: 12px; color: var(--muted); max-width: 180px; text-align: right; }
.history-download-message:empty { display: none; }
.history-not-paid { font-size: 12px; color: var(--muted); }
.history-checkout, .order-history-link, .delivery-history a { text-decoration: underline; text-underline-offset: 4px; font-size: 14px; }
.history-controls { display: flex; justify-content: center; gap: 12px; }
.history-controls:has(button:not([hidden])) { margin-top: 24px; }
.delivery-history { margin-top: 20px; font-size: 14px; color: var(--muted); }
@media (max-width: 520px) {
  #orders-page { padding: 32px var(--gutter) 48px; }
  .skeleton-button { width: 140px; }
  .history-order-top { padding: 12px 16px; }
  .history-order-body { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 20px; }
  .history-order-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .history-order-actions .primary { font-size: 13px; padding: 10px 12px; }
  .history-amount { font-size: 24px; }
  .history-download-message { grid-column: 1 / -1; max-width: none; text-align: left; }
}

/* Combined availability stays outside the filter row so controls remain aligned. */
.combined-options { padding: 18px 22px; margin: -1px 0 16px; border: 1px solid var(--line); background: var(--accent-soft); }
.combined-options fieldset { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.combined-options legend { margin-bottom: 10px; }
.combined-options label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.combined-options input { margin: 0; width: 16px; height: 16px; }
.combined-options p { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.contact-breakdown { margin: 0 0 16px; font-size: 12px; color: var(--muted); line-height: 1.6; }
@media (max-width: 600px) {
  .contact-options label { padding: 0 10px; white-space: nowrap; }
  .combined-options { padding: 16px; }
}

.aged-notice { margin: -1px 0 16px; padding: 12px 22px; border: 1px solid var(--line); color: var(--accent); background: var(--accent-soft); font-size: 13px; line-height: 1.5; }
.promo-breakdown > div > span:last-child { white-space: nowrap; }
.promo-breakdown { margin: 16px 0 12px; }
@media (max-width: 600px) { .aged-notice { padding: 12px 16px; } }
