/* owns: loy-c- (Tests/Loyalty/LoyaltyCenterPortalTests reads this line - every rule here leads with it, and no other stylesheet
   styles it).
   THE LOYALTY CENTER'S CATALOG PAGES (docs/claude/LOYALTY.md section 5.2) - categories (/loyalty/categories: the tree, a
   category's panel, the code maps, bringing a tree in) and collections (/loyalty/collections and one collection's page: the
   list, the smart rules builder, the live preview, a manual collection's picked items), the one filing control, the one picture
   field (Components/Loyalty/LoyaltyPictureField - every loyalty page's) and their components (Components/Loyalty/Catalog). This
   stylesheet owns every loy-c-* class; loyalty-center.css owns the rest of loy-* (the
   frame, cards, rows, forms, notes - reused here, never restyled). A token-only door, whole (Tests/ShellTokensOnlyTests):
   colours are --theme-* / --wf-* tokens only, so light, dark and every tenant theme read the same. */

/* ---- The page's parts (categories: the tree / codes from your systems / bring a tree in) - the shell's one tab bar
   (.wf-tabs / .wf-tab, pages.css), plain links in the keyboard's order; only their spacing here ---- */
.loy-c-tabs > .wf-tab { flex: none; white-space: nowrap; text-decoration: none; }
.loy-c-tabpanel { display: grid; gap: 16px; min-width: 0; }

/* ---- Shared small pieces ---- */
.loy-c-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.loy-c-stack { display: grid; gap: 12px; min-width: 0; }
.loy-c-quiet { margin: 0; color: var(--theme-text-secondary); font-size: 13px; }
.loy-c-strong { margin: 0; color: var(--theme-text-emphasis); font-size: 13.5px; font-weight: 600; }
.loy-c-subtitle { margin: 0; color: var(--theme-text-emphasis); font-size: 14px; font-weight: 650; }
.loy-c-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.loy-c-toolbar-field { flex: 1 1 10rem; min-width: 0; max-width: 20rem; }
.loy-c-narrow { max-width: 16rem; }
.loy-c-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.loy-c-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.loy-c-pager .loy-c-quiet { margin-right: auto; font-variant-numeric: tabular-nums; }
.loy-c-editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.loy-c-panel { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md); background: var(--wf-neutral-soft); }
.loy-c-pill { margin-left: 4px; }
.loy-c-skel-rows { height: 6rem; border-radius: var(--wf-radius-md); }
.loy-c-details summary { color: var(--wf-primary-ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.loy-c-details[open] summary { margin-bottom: 10px; }
.loy-c-findings { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; color: var(--wf-danger-ink); font-size: 12.5px; font-weight: 600; }
.loy-c-facts { display: grid; gap: 4px; margin: 0; padding-left: 18px; color: var(--theme-text-emphasis); font-size: 13px; }
.loy-c-reason { display: block; margin-top: 2px; color: var(--theme-text-secondary); font-size: 12.5px; }
.loy-c-saving { flex: 0 0 auto; padding: 2px 8px; border-radius: var(--wf-radius-pill); background: var(--wf-success-soft); color: var(--wf-success-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ---- Chips the person picked (a rule's categories, a collection's category pages) ---- */
.loy-c-picked { display: flex; flex-wrap: wrap; gap: 6px; }
.loy-c-picked:empty { display: none; }
.loy-c-picked-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--wf-line-strong); border-radius: var(--wf-radius-pill); background: var(--wf-card); color: var(--theme-text-emphasis); font-size: 12.5px; font-weight: 600; }
.loy-c-chip-x { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--theme-text-secondary); cursor: pointer; }
.loy-c-chip-x:hover { background: var(--wf-neutral-soft); color: var(--theme-text-emphasis); }
.loy-c-chip-x:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 1px; }
.loy-c-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- The category tree ---- */
.loy-c-tree-card { position: sticky; top: var(--wf-sticky-top); }
.loy-c-drag-hint { font-size: 12.5px; }
.loy-c-tree { display: grid; gap: 1px; max-height: 70vh; margin: 0; padding: 2px; overflow-y: auto; list-style: none; border-radius: var(--wf-radius-md); }
.loy-c-tree:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; }
.loy-c-node { display: flex; align-items: center; gap: 4px; min-height: 36px; padding-right: 6px; border: 1px dashed transparent; border-radius: var(--wf-radius-sm, 6px); }
.loy-c-node:hover { background: var(--wf-card-hover); }
.loy-c-node.is-selected { background: var(--wf-primary-soft); }
.loy-c-node.is-over { border-color: var(--wf-primary-ink); background: var(--wf-primary-soft); }
.loy-c-node.is-retired .loy-c-node-name { color: var(--theme-text-secondary); text-decoration: line-through; }
.loy-c-node.is-match .loy-c-node-name { font-weight: 700; }
.loy-c-node[draggable="true"] { cursor: grab; }
.loy-c-indent-0 { padding-left: 0; }
.loy-c-indent-1 { padding-left: 18px; }
.loy-c-indent-2 { padding-left: 36px; }
.loy-c-indent-3 { padding-left: 54px; }
.loy-c-indent-4 { padding-left: 72px; }
.loy-c-indent-5 { padding-left: 90px; }
.loy-c-twisty { display: grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--theme-text-secondary); cursor: pointer; }
.loy-c-twisty:hover { background: var(--wf-neutral-soft); color: var(--theme-text-emphasis); }
.loy-c-twisty.is-leaf { cursor: default; }
.loy-c-node-main { display: flex; flex: 1 1 auto; align-items: center; gap: 8px; min-width: 0; min-height: 34px; padding: 0 4px; border: 0; background: transparent; color: var(--theme-text-emphasis); font-size: 13.5px; text-align: left; cursor: pointer; }
.loy-c-node.is-selected .loy-c-node-main { color: var(--wf-primary-ink); font-weight: 600; }
.loy-c-node-icon { flex: 0 0 auto; color: var(--theme-text-secondary); }
.loy-c-node-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loy-c-node-count { flex: 0 0 auto; padding: 0 7px; border-radius: var(--wf-radius-pill); background: var(--wf-neutral-soft); color: var(--theme-text-secondary); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.loy-c-drop-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px dashed var(--wf-line-strong); border-radius: var(--wf-radius-md); color: var(--theme-text-secondary); font-size: 13px; }
.loy-c-drop-top.is-over { border-color: var(--wf-primary-ink); background: var(--wf-primary-soft); color: var(--wf-primary-ink); }

/* ---- One category's panel ---- */
.loy-c-detail { gap: 16px; }
.loy-c-detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.loy-c-detail-title { display: grid; gap: 4px; min-width: 0; }
.loy-c-path { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; color: var(--theme-text-secondary); font-size: 12.5px; }
.loy-c-path span + span::before { content: "\203A"; margin-right: 4px; }
.loy-c-pick-hint { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--theme-text-secondary); text-align: center; }
.loy-c-pick-hint i { font-size: 24px; color: var(--wf-primary-ink); }
.loy-c-retire { background: var(--wf-danger-soft); }
.loy-c-editor { display: grid; gap: 14px; }
.loy-c-editor-fields { display: grid; gap: 14px; }
.loy-c-icon-field { display: flex; align-items: center; gap: 8px; }
.loy-c-icon-preview { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: var(--wf-radius-tile); background: var(--wf-primary-soft); color: var(--wf-primary-ink); font-size: 17px; }
.loy-c-picker { min-width: 0; }
.loy-c-filed { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--wf-line); }
.loy-c-filed-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.loy-c-filed-head .loy-c-subtitle { margin-right: auto; }
.loy-c-filed-kind { width: auto; }
.loy-c-filed-row a.loy-row-title { color: var(--wf-primary-ink); text-decoration: none; }
.loy-c-filed-row a.loy-row-title:hover { text-decoration: underline; }
.loy-c-filed-editor { padding: 4px 0 12px; list-style: none; }
.loy-c-file-here { background: var(--wf-card); }

/* ---- The one filing control (Components/Loyalty/Catalog/CategoryFilingEditor) - where one thing is filed ---- */
.loy-c-filing { display: grid; gap: 10px; min-width: 0; }
.loy-c-filing-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.loy-c-filing-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.loy-c-filing-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 4px; border-top: 1px solid var(--wf-line); }
.loy-c-filing-row:first-child { border-top: 0; }
.loy-c-filing-row.is-primary { background: var(--wf-primary-soft); border-radius: var(--wf-radius-sm, 6px); }
.loy-c-filing-pick { display: flex; flex: 1 1 auto; align-items: center; gap: 10px; min-width: 0; margin: 0; cursor: pointer; }
.loy-c-filing-pick input { flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--wf-primary-ink); }
.loy-c-filing-x { flex: 0 0 auto; }
.loy-c-filing-add { max-width: 24rem; }

/* ---- The one picture field (Components/Loyalty/LoyaltyPictureField) - choose a file or paste an address, seen at once ---- */
.loy-c-pic { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.loy-c-pic-preview { display: grid; place-items: center; flex: 0 0 auto; width: 72px; height: 72px; overflow: hidden; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md); background: var(--wf-neutral-soft); color: var(--theme-text-secondary); font-size: 22px; }
.loy-c-pic-preview img { width: 100%; height: 100%; object-fit: cover; }
.loy-c-pic-preview.is-empty { border-style: dashed; }
.loy-c-pic-body { display: grid; flex: 1 1 auto; gap: 8px; min-width: 0; }
.loy-c-pic-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.loy-c-pic-line { font-size: 12.5px; }

/* ---- Codes from your systems ---- */
.loy-c-maps { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.loy-c-maps-side { display: grid; gap: 16px; min-width: 0; }
.loy-c-maps-table th:last-child, .loy-c-maps-table .loy-c-actions-cell { width: 11rem; text-align: right; }
.loy-c-resolved { display: grid; gap: 8px; }
.loy-c-resolved .loy-row { flex-wrap: nowrap; }

/* ---- Bring a tree in ---- */
.loy-c-import { display: grid; gap: 16px; }
.loy-c-import-text { font-size: 12.5px; }
.loy-c-import-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.loy-c-import-read { display: grid; gap: 4px; padding: 10px 14px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-md); background: var(--wf-neutral-soft); }
.loy-c-problems { color: var(--wf-danger-ink); font-size: 12.5px; }
.loy-c-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.loy-c-count { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--wf-line); border-radius: var(--wf-radius-pill); color: var(--theme-text-secondary); font-size: 13px; }
.loy-c-count strong { color: var(--theme-text-emphasis); font-size: 15px; font-variant-numeric: tabular-nums; }
.loy-c-count.is-refused { background: var(--wf-danger-soft); }
.loy-c-bulk-table td { vertical-align: top; }

/* ---- Collections: the list and a new one ---- */
.loy-c-new { background: var(--wf-card); }
.loy-c-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.loy-c-choices legend { margin-bottom: 6px; }
.loy-c-choice { position: relative; display: grid; gap: 4px; padding: 12px 14px 12px 40px; border: 1px solid var(--wf-line-strong); border-radius: var(--wf-radius-md); background: var(--wf-card); cursor: pointer; }
.loy-c-choice input { position: absolute; top: 14px; left: 14px; width: 16px; height: 16px; accent-color: var(--wf-primary-ink); }
.loy-c-choice.is-on { border-color: var(--wf-primary-ink); background: var(--wf-primary-soft); box-shadow: 0 0 0 1px var(--wf-primary-ink); }
.loy-c-choice-title { color: var(--theme-text-emphasis); font-size: 14px; font-weight: 600; }
.loy-c-choice-sub { color: var(--theme-text-secondary); font-size: 12.5px; }
.loy-c-coll-table th:nth-child(4) { width: 9rem; }
.loy-c-coll-table th:nth-child(5) { width: 7rem; }

/* ---- A smart collection's rules ---- */
.loy-c-rules-section { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }
.loy-c-rules-sentence { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--wf-radius-md); background: var(--wf-primary-soft); color: var(--theme-text-emphasis); font-size: 13px; }
.loy-c-rules { display: grid; gap: 8px; }
.loy-c-rules-fields { display: grid; gap: 0; }
.loy-c-rule { position: relative; display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 6px 16px; margin: 0; padding: 12px 44px 12px 0; border: 0; border-top: 1px solid var(--wf-line); min-width: 0; }
.loy-c-rule-x { position: absolute; top: 8px; right: 0; }
.loy-c-rule-add { padding-right: 0; }
.loy-c-rules-fields > .loy-c-rule:first-child { border-top: 0; }
.loy-c-rule.is-invalid .loy-c-rule-label { color: var(--wf-danger-ink); }
.loy-c-rule-label { float: none; width: auto; margin: 0; padding: 0; color: var(--theme-text-emphasis); font-size: 13px; font-weight: 600; }
.loy-c-rule-body { display: grid; gap: 6px; min-width: 0; }
.loy-c-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.loy-c-checks.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }

/* ---- More options behind a one-line summary (a collection's art and note - portal-look-and-feel 3.11) ---- */
.loy-c-fold { border-top: 1px solid var(--wf-line); }
.loy-c-fold-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; min-height: 44px; padding: 12px 0; cursor: pointer; list-style-position: outside; }
.loy-c-fold-summary:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; border-radius: var(--wf-radius-xs); }
.loy-c-fold[open] > .loy-c-fold-summary { padding-bottom: 4px; }

/* ---- What a smart collection matches now ---- */
.loy-c-preview { gap: 12px; }
.loy-c-preview-list { counter-reset: none; }
.loy-c-preview-list .loy-row { flex-wrap: nowrap; }

/* ---- A manual collection's picked items ---- */
.loy-c-items { gap: 14px; }
.loy-c-picks { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.loy-c-pick { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--wf-line); border-radius: var(--wf-radius-sm, 6px); }
.loy-c-pick:first-child { border-top: 0; }
.loy-c-pick[draggable="true"] { cursor: grab; }
.loy-c-pick.is-dragging { opacity: .55; }
.loy-c-pick.is-over { background: var(--wf-primary-soft); box-shadow: inset 0 2px 0 var(--wf-primary-ink); }
.loy-c-pick-place { display: grid; place-items: center; flex: 0 0 auto; min-width: 26px; height: 26px; border-radius: var(--wf-radius-tile); background: var(--wf-neutral-soft); color: var(--theme-text-secondary); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.loy-c-grip { flex: 0 0 auto; color: var(--theme-text-secondary); }
.loy-c-add { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--wf-line); }
.loy-c-results { max-height: 22rem; overflow-y: auto; }

/* ---- Narrower sheets ---- */
@container page (max-width: 960px) {
    .loy-c-split, .loy-c-maps { grid-template-columns: minmax(0, 1fr); }
    .loy-c-tree-card { position: static; }
    .loy-c-rules-section { grid-template-columns: minmax(0, 1fr); }
}

@container page (max-width: 640px) {
    .loy-c-rule { grid-template-columns: minmax(0, 1fr); }
    .loy-c-tabs > .wf-tab { min-height: 44px; }
    .loy-c-pic { flex-wrap: wrap; }
    .loy-c-indent-4, .loy-c-indent-5 { padding-left: 54px; }
    .loy-c-toolbar-field { max-width: none; }
    .loy-c-maps-table th:last-child, .loy-c-maps-table .loy-c-actions-cell { width: auto; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    .loy-c-node, .loy-c-pick { transition: none; }
}
