/* ==========================================================================
   🧩 The commerce modules (docs/briefs/COMMERCE-PLATFORM.md): Settings → Modules and the screens each module adds to
   its own page. Tokens only (css/tokens.css); phone first, the wide layout from 720px.
   ========================================================================== */

/* Settings → Modules: one row per module, its words on the left, its state and switch on the right */
.module-list { display: grid; gap: var(--space-2); }
.module-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); align-items: center;
  padding: var(--space-3) var(--space-4); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface-raised); }
.module-row__main { display: grid; gap: 2px; min-width: 0; }
.module-row__head { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.module-row__name { font-weight: var(--weight-semibold); font-size: var(--text-base); color: var(--text); }
.module-row__about { display: none; margin: var(--space-1) 0 0; font-size: var(--text-sm); line-height: 1.45; color: var(--text-muted); max-width: 60ch; }
.module-row.is-open .module-row__about { display: block; }
.module-row.is-open .field__info { color: var(--accent); background: var(--accent-soft); }
.module-row__main .field__help { margin: var(--space-1) 0 0; }
.module-row__link { font-size: var(--text-sm); color: var(--accent); }
.module-row__side { display: flex; align-items: center; gap: var(--space-2); justify-content: flex-end; }
@media (max-width: 520px) {
  .module-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--space-2); }
  .module-row__side { grid-column: 1 / -1; justify-content: space-between; flex-wrap: wrap; }
  .module-row__side .toggle { margin-left: auto; }
}

/* 📦 Smart inventory: the shop's own product details, a product's batches, the CSV preview */
.detail-fields { display: grid; gap: var(--space-2); }
.detail-field { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: var(--space-2); align-items: center; }
.detail-field:has(.detail-field__unit), .detail-field:has(.detail-field__choices) {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto auto; }
.detail-field .check { white-space: nowrap; }
@media (max-width: 640px) {
  .detail-field, .detail-field:has(.detail-field__unit), .detail-field:has(.detail-field__choices) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: var(--space-3); border: var(--border-width) solid var(--border);
    border-radius: var(--radius-lg); background: var(--surface-raised); }
  .detail-field > .input:first-child, .detail-field__choices { grid-column: 1 / -1; }
}
.batch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.batch-list__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-2); align-items: center;
  padding: var(--space-2) var(--space-3); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); }
.batch-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
.batch-when { display: grid; gap: 2px; justify-items: start; }
.csv-problems { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
.csv-problems strong { color: var(--danger); font-weight: var(--weight-semibold); }
.section__title.batch-title { margin-top: var(--space-5); }

/* ⚖️ Tax & compliance: the shop's rules, one block each */
.rule-list { display: grid; gap: var(--space-3); }
.rule-row { display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface-raised); }
.rule-row__head { display: grid; grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.rule-row__check { align-self: end; padding-bottom: var(--space-2); }
@media (min-width: 640px) {
  .rule-row .form__grid { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); }
  .rule-row .form__grid:has(input[type="date"]) { grid-template-columns: minmax(0, 1fr) minmax(0, 12rem); }
  .rule-list + .btn-row > .select { width: auto; min-width: 12rem; }
}
.rule-chips { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; }
.rule-chips__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-subtle); margin-right: var(--space-1); }
.chip-check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--space-3); border: var(--border-width) solid var(--border);
  border-radius: var(--radius-pill); font-size: var(--text-sm); cursor: pointer; }
.chip-check input { accent-color: var(--accent); }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.card__body > .form > p.field__help.rule-note:first-child { display: block; }   /* the plain "not tax advice" note always shows */
.rule-report { margin-top: var(--space-2); }
@media (max-width: 520px) { .rule-row__head { grid-template-columns: minmax(0, 1fr) auto; } .rule-row__head > .input { grid-column: 1 / -1; grid-row: 2; } }

/* 🪪 ID checks: a warning the owner acts on (provider not connected, an age Stripe did not give) */
.notice--warning { background: var(--warning-soft); border-color: color-mix(in oklab, var(--warning) 35%, transparent); }
.redact-list { margin: 0; padding-left: var(--space-4); display: grid; gap: 2px; font-size: var(--text-sm); }

/* 📣 Campaigns: a nearby offer's drawn plan (no map tiles): the point, its circle and radius, north up */
.nearby-plan { max-width: 320px; border: var(--border-width) solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.nearby-plan svg { display: block; width: 100%; height: auto; }
.nearby-plan__area { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.nearby-plan__ring { fill: none; stroke: var(--border-strong); stroke-dasharray: 3 3; }
.nearby-plan__dot { fill: var(--accent); }
.nearby-plan__radius { stroke: var(--text-subtle); stroke-width: 1; }
.nearby-plan__label, .nearby-plan__north { fill: var(--text); font-size: 10px; font-family: var(--font-sans, inherit); }

/* 🏪 Templates & home layout: the Mobile shop's Home tab (templates, the spreadsheet, the home's sections in order) */
.template-list, .home-sections { display: grid; gap: var(--space-2); }
.template-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--border); border-radius: var(--radius); background: var(--surface-raised); }
.home-section { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2);
  border: var(--border-width) solid var(--border); border-radius: var(--radius); background: var(--surface-raised); }
/* the shared drag grip shows where a mouse can use it; a phone has the arrows */
.home-section .option-grip { display: none; flex: none; width: 1.5rem; }
@media (pointer: fine) { .home-section .option-grip { display: block; } }
.home-section.is-dragging { box-shadow: var(--shadow-sm); }
.home-section__name { flex: 1; min-width: 0; }
.home-section__up svg { transform: rotate(-90deg); }
.home-section__down svg { transform: rotate(90deg); }
.home-section .btn:disabled { background: transparent; }   /* the end of the list: a faded arrow, no dark box */

/* a flush card's inset parts, with the phone list between them running edge to edge */
.card-pad { padding: var(--space-5); }
