:root {
  color-scheme: light;
  --paper: #f8f9f5;
  --card: #fff;
  --ink: #21281e;
  --muted: #53604d;
  --green: #344d2b;
  --line: #d9e1d4;
  --soft: #edf3e8;
  font-family: Arial, Helvetica, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 1rem; line-height: 1.55; }
a { color: var(--green); text-underline-offset: .22em; }
:focus-visible { outline: 3px solid #638453; outline-offset: 4px; }
.wrap { width: min(69rem, 100% - 4rem); margin-inline: auto; }
.skip { position: absolute; z-index: 1; top: .7rem; left: .7rem; padding: .5rem .85rem; background: #fff; transform: translateY(-150%); }
.skip:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); background: var(--card); }
.header-content, .footer-content, .page-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.header-content { min-height: 70px; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; font-weight: 750; white-space: nowrap; }
.brand img { border-radius: 7px; display: block; }
.button { border: 1px solid transparent; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; min-height: 41px; padding: .6rem .85rem; text-align: center; text-decoration: none; font: inherit; font-size: .94rem; font-weight: 700; line-height: 1.2; cursor: pointer; }
.button-outline { background: var(--card); border-color: #aab8a3; color: var(--green); }
.button-outline:hover { background: #f0f4ec; }
.button-main { background: var(--green); color: #fff; }
.button-main:hover { background: #46663a; }
main { padding: 1.9rem 0 3.3rem; min-height: 69vh; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.18; letter-spacing: -.018em; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
.mode-link { font-size: .94rem; }
.sample-notice { margin-top: .8rem; color: var(--muted); }
.share { margin-top: 1.3rem; padding: 1.1rem 1.3rem; border: 1px solid #cbd8c4; border-radius: 9px; background: var(--soft); }
.share h2 { margin-bottom: .65rem; font-size: 1.2rem; }
.share-row { display: flex; align-items: center; gap: .7rem; }
.share-row p { flex: 1; }
.share-row input { flex: 1; min-width: 0; padding: .6rem .75rem; border: 1px solid #aab8a3; background: var(--card); border-radius: 5px; color: var(--ink); font: inherit; }
#copy-status:not(:empty) { margin-top: .5rem; color: var(--muted); }
.section-nav { display: flex; gap: 1.55rem; border-bottom: 1px solid var(--line); margin: 1.35rem 0 1.35rem; }
.section-nav a { padding: .65rem 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 700; text-decoration: none; }
.section-nav a:hover, .section-nav a[aria-current="page"] { color: var(--green); border-color: var(--green); }
.view + .view { margin-top: 2rem; }
.view h2 + p { margin-top: .35rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin: .95rem 0 1.15rem; }
.stat, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.stat { padding: .95rem 1rem; }
.stat dt { color: var(--muted); line-height: 1.3; }
.stat dd:first-of-type { margin-top: .32rem; font-size: 1.8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.payout { background: var(--soft); border-color: #cbd8c4; }
.payout .button { margin: .42rem 0; }
#payout-description { display: block; font-size: .88rem; color: var(--muted); }
.panel { padding: 1rem 1.15rem; }
.panel + .panel { margin-top: .85rem; }
.results { width: 100%; margin-top: .55rem; border-collapse: collapse; text-align: left; }
.results th, .results td { padding: .56rem .2rem; border-bottom: 1px solid var(--line); }
.results thead { color: var(--muted); }
.results tbody tr:last-child > * { border-bottom: 0; }
.results tr > * ~ * { text-align: right; }
.results th[scope="row"] { font-weight: 500; overflow-wrap: anywhere; }
.material-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin-top: .95rem; }
.material-grid .panel { margin-top: 0; }
.material p { margin-top: .55rem; }
.material p + a { display: inline-block; margin-top: .5rem; }
.downloads { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .75rem; }
.zone-footer { border-top: 1px solid var(--line); padding: 1rem 0; background: var(--card); }
.footer-content { flex-wrap: wrap; }
dialog { width: min(31rem, 100% - 2rem); padding: 1.3rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--card); }
dialog::backdrop { background: rgb(24 32 21 / 48%); }
dialog p { margin: .65rem 0 1rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

@media (max-width: 850px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .wrap { width: calc(100% - 1.75rem); }
  .header-content { gap: .4rem; }
  .brand { gap: .35rem; }
  .brand img { width: 34px; height: 34px; }
  .header-content .button { padding-inline: .5rem; font-size: .83rem; }
  main { padding-top: 1.3rem; }
  .share, .stat, .panel { padding: .8rem; }
  .share-row { align-items: flex-start; flex-direction: column; }
  .share-row input { width: 100%; }
  .stat dd:first-of-type { font-size: 1.5rem; }
  .material-grid { grid-template-columns: 1fr; }
}
.header-actions, .admin-form { display:flex; align-items:center; flex-wrap:wrap; gap:.55rem; }
.page-title { margin-bottom:1rem; }
.notice { background:var(--soft); padding:.65rem .85rem; border-radius:5px; margin-bottom:.8rem; }
.payout-amount { font-size:1.8rem; font-weight:750; }
.payout form { display:inline; }
.button:disabled { cursor:default; opacity:.65; }
.panel > p + p, .material > img, .admin-item > p, .admin-form { margin-top:.55rem; }
.material > img { display:block; max-width:100%; width:auto; height:auto; max-height:180px; }
.share-copy { grid-column:1 / -1; }
.table-scroll { overflow-x:auto; }
.admin-item { border-top:1px solid var(--line); margin-top:.75rem; padding-top:.75rem; }
.admin-form input:not([type="hidden"]) { width:10rem; padding:.35rem .5rem; }
.wrap-text { overflow-wrap:anywhere; }
.admin-section { scroll-margin-top: 1rem; }
.admin-section > h2 + p { margin-top: .5rem; }
.admin-back { margin-bottom: .85rem; }
.admin-back ~ .view, .view + .admin-section { margin-top: 1.15rem; }
.admin-nav { flex-wrap: wrap; column-gap: 1.35rem; row-gap: 0; }
.admin-search { margin-block: .8rem 1rem; }
.admin-search input:not([type="hidden"]) { width: min(16rem, 100%); font: inherit; }
.admin-table .results { min-width: 62rem; font-variant-numeric: tabular-nums; }
.admin-table .results th, .admin-table .results td { padding-inline: .5rem; }
.admin-table tbody th { min-width: 9.5rem; }
.admin-table tbody th a { font-weight: 700; }
.admin-table tbody th small { display: block; color: var(--muted); line-height: 1.25; }
.admin-table tbody td { white-space: nowrap; }
.admin-pagination { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }

@media (max-width: 580px) {
  .header-actions { justify-content: flex-end; }
  .admin-search label { flex-basis: 100%; }
}

.portal-layout { display: grid; grid-template-columns: 12rem minmax(0,1fr); align-items: start; gap: 1.3rem; }
.portal-menu { display: grid; gap: .25rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.portal-menu a { display: block; padding: .56rem .75rem; border-radius: 5px; text-decoration: none; font-weight: 700; }
.portal-menu a:hover, .portal-menu a[aria-current="page"] { color: var(--green); background: var(--soft); }
.portal-content .stats { grid-template-columns: repeat(auto-fit,minmax(9rem,1fr)); }
.portal-content .results th, .portal-content .results td { overflow-wrap: anywhere; min-width: 4rem; }
.portal-content h2 { margin-bottom: .65rem; }
.product-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; list-style: none; margin: .75rem 0 0; padding: 0; }
.product-card { height: 100%; display: grid; justify-items: center; gap: .4rem; padding: .6rem .45rem; color: var(--ink); text-align: center; text-decoration: none; font-weight: 700; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.product-card:hover, .product-card[aria-current="page"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.product-card[aria-current="page"] span { color: var(--green); }
.product-card img { width: min(100%,9rem); height: 5.4rem; object-fit: contain; }
.product-link { margin: 0 0 1rem; }
.product-link h3 { margin-bottom: .5rem; }
.product-link p:not(:empty) { margin-top: .5rem; color: var(--muted); }
.share-code { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.product-resources { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: .75rem; }
.product-resources .panel { margin: 0; }
.partner-qr { display: block; width: min(100%,16rem); height: auto; margin: .5rem auto; }
.qr-product { margin-top: .28rem; color: var(--muted); }
.post-copy { box-sizing: border-box; display: block; width: 100%; min-height: 7rem; margin: .65rem 0; padding: .55rem; resize: vertical; font: inherit; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; }

@media (max-width: 650px) {
  .portal-layout { grid-template-columns: minmax(0,1fr); gap: 1rem; }
  .portal-menu { display: flex; flex-wrap: wrap; }
  .portal-menu a { padding-inline: .5rem; }
  .product-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-resources { grid-template-columns: minmax(0,1fr); }
}

@media print {
  body:has(.qr-panel) { background: white; color: black; }
  body:has(.qr-panel) > :not(main),
  main:has(.qr-panel) > :not(.portal-layout),
  .portal-layout:has(.qr-panel) > :not(.portal-content),
  .portal-content:has(.qr-panel) > :not(.product-materials),
  .product-materials > :not(.product-resources),
  .product-resources > :not(.qr-panel),
  .qr-panel > :not(.qr-product,.partner-qr) { display: none; }
  main:has(.qr-panel) { width: 100%; min-height: 0; margin: 0; padding: 0; }
  .portal-layout:has(.qr-panel), .product-resources:has(.qr-panel) { display: block; }
  .portal-content .product-materials { margin: 0; }
  .qr-panel { padding: 0; border: 0; break-inside: avoid; text-align: center; }
  .qr-product { color: black; font-weight: 700; }
  .partner-qr { width: 60mm; height: auto; margin: 2mm auto 0; }
}

.commission-back, .commission-form-actions, .commission-tier-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.commission-partner { margin-top: 1rem; }
.commission-products { display: grid; grid-template-columns: repeat(auto-fit,minmax(9rem,1fr)); gap: .55rem; margin: 1rem 0; }
.commission-products a { display: flex; flex-direction: column; justify-content: center; min-height: 3.8rem; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card); text-decoration: none; font-weight: 700; }
.commission-products a:hover, .commission-products a[aria-current="page"] { background: var(--soft); border-color: var(--green); }
.commission-saved { font-size: .85rem; color: var(--muted); font-weight: 400; }
.commission-panel > p { margin-top: .5rem; }
.commission-form { margin-top: .9rem; }
.commission-form > p { margin-bottom: .85rem; color: var(--muted); }
.commission-tier { min-inline-size: 0; margin: 0 0 .85rem; padding: .75rem; border: 1px solid var(--line); border-radius: 6px; }
.commission-tier legend { padding: 0 .35rem; font-weight: 700; }
.commission-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,11rem),1fr)); gap: .65rem; }
.commission-fields label { display: grid; gap: .3rem; align-content: end; }
.commission-fields input { font: inherit; width: 100%; padding: .45rem .55rem; border: 1px solid #aab8a3; border-radius: 5px; background: var(--card); color: var(--ink); }
.commission-tier-actions { margin-top: .65rem; }
.commission-tier-actions .button { min-height: 2rem; padding: .34rem .55rem; }
.admin-verification { flex-basis:100%; display:flex; align-items:flex-start; gap:.5rem; }
.admin-form .admin-verification input[type="checkbox"] { flex:none; width:1.15rem; height:1.15rem; margin:.2rem 0 0; }
.legal-content { max-width:76ch; }
.legal-content .legal-version { color:var(--muted); }
.legal-content section { margin-top:1.35rem; }
.legal-content section p { margin-top:.5rem; }
.legal-content section h2 { font-size:1.15rem; }
.partner-agreement { margin-bottom:.75rem; color:var(--muted); font-size:.94rem; }
