/* ==========================================================================
   Commerce module (WP-I): storefront (public /shop and portal), cart, checkout,
   order tracking, and the staff commerce screens. Prefix cm-.
   ========================================================================== */

/* ---- storefront shell ---- */
.cm-wrap { max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }
.cm-announce { background: linear-gradient(90deg, #0b2a57, #0962d3); color: #fff; font-size: 12.5px; padding: 8px 16px; text-align: center; }
.cm-announce a { color: #bfe3ff; text-decoration: underline; }
.cm-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.cm-bar .cm-search { flex: 1 1 280px; display: flex; gap: 6px; min-width: 0; }
.cm-bar .cm-search input { flex: 1; min-width: 0; }
.cm-storepick { display: flex; gap: 4px; flex-wrap: wrap; }
.cm-storepick a { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 5px 11px; font-size: 12px; color: var(--text2); white-space: nowrap; }
.cm-storepick a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.cm-cartlink { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.cm-cartlink .n { background: #e8632a; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }

/* ---- hero, tiles, strips ---- */
.cm-hero { border-radius: 8px; padding: 34px 32px; color: #fff; position: relative; overflow: hidden; min-height: 190px; display: flex; flex-direction: column; justify-content: center; margin-bottom: 14px; }
.cm-hero h2 { color: #fff; font: 700 28px/1.15 var(--fd); margin: 0 0 8px; max-width: 640px; }
.cm-hero p { max-width: 560px; color: #dceaff; font-size: 14px; margin-bottom: 14px; }
.cm-hero:after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.cm-hero .ct-btn { align-self: flex-start; }
.tone-navy { background: linear-gradient(120deg, var(--brand-navy, #061a36), #0b4a8f); } .tone-blue { background: linear-gradient(120deg, #0962d3, #29b6db); }
.tone-teal { background: linear-gradient(120deg, #0c8ec6, #13b985); } .tone-green { background: linear-gradient(120deg, #04955d, #13b985); }
.tone-amber { background: linear-gradient(120deg, #c77700, #f5a524); } .tone-coral { background: linear-gradient(120deg, #d23a10, #ef5927); }
.tone-purple { background: linear-gradient(120deg, #4a2bb0, #7553d6); }
.cm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.cm-tile { border-radius: 6px; padding: 18px; color: #fff; min-height: 120px; display: flex; flex-direction: column; justify-content: space-between; }
.cm-tile h3 { color: #fff; font-size: 16px; margin: 0 0 6px; }
.cm-tile p { color: #e5f0ff; font-size: 12.5px; margin: 0 0 10px; }
.cm-tile a { color: #fff; font-weight: 700; text-decoration: underline; }
.cm-sect { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 0 10px; flex-wrap: wrap; }
.cm-sect h2 { font-size: 18px; margin: 0; }
.cm-sect a { font-size: 12.5px; }

/* ---- catalogue ---- */
.cm-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.cm-facets { background: #fff; border: 1px solid var(--line2); border-radius: 6px; padding: 12px; position: sticky; top: 80px; }
.cm-facets h4 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.cm-facets h4:first-child { margin-top: 0; }
.cm-facets a { display: flex; justify-content: space-between; gap: 6px; padding: 4px 6px; border-radius: 3px; color: var(--text); font-size: 12.5px; }
.cm-facets a:hover, .cm-facets a.on { background: #eaf3ff; color: var(--blue); }
.cm-facets a .n { color: var(--muted); font-size: 11.5px; }
.cm-facets .sub { padding-left: 14px; }
.cm-facets .cm-price { display: flex; gap: 6px; }
.cm-facets .cm-price input { width: 50%; }
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.cm-grid.four { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cm-card { background: #fff; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; position: relative; transition: box-shadow .15s, transform .15s; }
.cm-card:hover { box-shadow: 0 6px 16px rgba(18, 45, 72, .12); transform: translateY(-1px); }
.cm-card .img { display: block; aspect-ratio: 4 / 3; background: #eaf0f6; }
.cm-card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cm-card .name { font-weight: 700; color: var(--text); font-size: 13.5px; line-height: 1.3; }
.cm-card .sku { font-size: 11px; color: var(--muted); }
.cm-card .price { margin-top: auto; padding-top: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cm-card .why { font-size: 12px; color: var(--text2); background: #f2f7fc; border-left: 3px solid #29b6db; padding: 6px 8px; border-radius: 2px; }
.cm-price-now { font-size: 17px; font-weight: 700; color: var(--text); }
.cm-price-was { font-size: 12.5px; color: var(--muted); text-decoration: line-through; }
.cm-price-src { font-size: 11px; color: var(--okFg); background: var(--okBg); border-radius: 10px; padding: 1px 7px; }
.cm-badge { position: absolute; left: 10px; top: 10px; background: #e8632a; color: #fff; font-size: 11px; font-weight: 700; border-radius: 3px; padding: 2px 7px; z-index: 1; }
.cm-badge.feat { background: #0962d3; left: auto; right: 10px; }
.cm-stock { font-size: 11.5px; }
.cm-stock.low { color: var(--warnFg); } .cm-stock.out { color: var(--badFg); }
.cm-sorts { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }

/* ---- product page ---- */
.cm-product { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cm-gallery img { width: 100%; border-radius: 8px; border: 1px solid var(--line2); display: block; background: #eaf0f6; }
.cm-buy { background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: 18px; }
.cm-buy h1 { font: 700 24px/1.2 var(--fd); margin: 0 0 4px; }
.cm-buy .cm-price-now { font-size: 26px; }
.cm-buy form.cm-add { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0; }
.cm-buy form.cm-add .ct-field { margin: 0; width: 110px; }
.cm-attrs { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cm-attrs th, .cm-attrs td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.cm-attrs th { color: var(--muted); font-weight: 400; width: 40%; }
.cm-rules li { margin-bottom: 4px; font-size: 12.5px; }
.cm-bundle li { font-size: 12.5px; margin-bottom: 3px; }

/* ---- cart & checkout ---- */
.cm-cart { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cm-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line2); align-items: center; }
.cm-line:last-child { border-bottom: 0; }
.cm-line img { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line2); }
.cm-line .meta { min-width: 0; }
.cm-line .meta b { display: block; }
.cm-line .qty { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.cm-line .qty input { width: 64px; }
.cm-sum { background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: 14px; position: sticky; top: 80px; }
.cm-sum dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0 0 10px; font-size: 13px; }
.cm-sum dt { color: var(--text2); } .cm-sum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.cm-sum .total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line2); padding-top: 8px; }
.cm-sum .disc { color: var(--okFg); }
.cm-codes { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.cm-code { background: var(--okBg); color: var(--okFg); border-radius: 12px; padding: 3px 10px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.cm-code button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.cm-steps { margin-bottom: 14px; }
.cm-ship label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line2); border-radius: 5px; padding: 10px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.cm-ship label:has(input:checked) { border-color: var(--blue); background: #f0f7ff; }
.cm-ship .r { margin-left: auto; font-weight: 700; white-space: nowrap; }
.cm-offer { display: flex; gap: 12px; align-items: center; border: 1px dashed #13b985; background: #effaf5; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; }
.cm-offer i { font-size: 22px; color: #04955d; }
.cm-offer .tx { flex: 1; min-width: 0; }
.cm-thanks { text-align: center; padding: 26px 16px; }
.cm-thanks i.big { font-size: 44px; color: #13b985; }

/* ---- tracking ---- */
.cm-track { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; flex-wrap: wrap; }
.cm-track li { flex: 1 1 120px; position: relative; padding: 26px 6px 0; text-align: center; font-size: 12px; color: var(--muted); }
.cm-track li:before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 3px; background: #dbe4ec; }
.cm-track li:after { content: ""; position: absolute; left: 50%; top: 2px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #dbe4ec; border: 3px solid #fff; box-shadow: 0 0 0 1px #dbe4ec; }
.cm-track li.done { color: var(--okFg); font-weight: 700; } .cm-track li.done:before, .cm-track li.done:after { background: #13b985; box-shadow: 0 0 0 1px #13b985; }
.cm-track li.now { color: var(--blue); font-weight: 700; } .cm-track li.now:after { background: #0962d3; box-shadow: 0 0 0 4px #d8ebff; }

/* ---- quiz ---- */
.cm-quiz fieldset { border: 1px solid var(--line2); border-radius: 6px; padding: 12px; margin: 0 0 10px; background: #fff; }
.cm-quiz legend { font-weight: 700; padding: 0 6px; }
.cm-quiz .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-quiz .opts label { border: 1px solid var(--line); border-radius: 18px; padding: 6px 12px; cursor: pointer; background: #fff; }
.cm-quiz .opts label:has(input:checked) { background: var(--navy); color: #fff; border-color: var(--navy); }
.cm-quiz .opts input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---- staff screens ---- */
.cm-thumb { width: 44px; height: 33px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line2); vertical-align: middle; }
.cm-merch td input[type=number] { width: 72px; } .cm-merch td input[type=text] { width: 100px; }
.cm-flow { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 10px; padding: 0; }
.cm-flow li { background: #eef3f8; border-radius: 14px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.cm-flow li.done { background: var(--okBg); color: var(--okFg); } .cm-flow li.now { background: #dbeafe; color: #0f5aa6; font-weight: 700; }
.cm-flow li.bad { background: var(--badBg); color: var(--badFg); }
.cm-actions { display: grid; gap: 10px; }
.cm-actions details { border: 1px solid var(--line2); border-radius: 5px; background: #fff; }
.cm-actions summary { cursor: pointer; padding: 9px 12px; font-weight: 700; list-style: none; display: flex; gap: 8px; align-items: center; }
.cm-actions summary::-webkit-details-marker { display: none; }
.cm-actions details[open] summary { border-bottom: 1px solid var(--line2); }
.cm-actions .in { padding: 12px; }
.cm-preview { border-radius: 6px; padding: 16px; color: #fff; min-height: 90px; }
.cm-preview h4 { color: #fff; margin: 0 0 4px; }
.cm-preview p { margin: 0; color: #e5f0ff; font-size: 12.5px; }

@media (max-width: 980px) {
    .cm-layout, .cm-product, .cm-cart { grid-template-columns: 1fr; }
    .cm-facets, .cm-sum { position: static; }
}
@media (max-width: 560px) {
    .cm-wrap { padding: 12px 12px 30px; }
    .cm-hero { padding: 22px 18px; min-height: 150px; }
    .cm-hero h2 { font-size: 21px; }
    .cm-grid, .cm-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .cm-card .name { font-size: 12.5px; }
    .cm-price-now { font-size: 15px; }
    .cm-line { grid-template-columns: 56px minmax(0, 1fr); }
    .cm-line img { width: 56px; height: 42px; }
    .cm-line .qty { grid-column: 1 / -1; justify-content: flex-start; }
    .cm-track li { flex-basis: 33%; }
}
.db-sect.s-commerce { --a1: #ef5927; --a2: #c2410c; }
