/* CREVARD palettes. Loaded after crevard.css; theme selection changes no data. */
:root,
html[data-theme="apricot"] {
  color-scheme:light;
  --ink:#302332;
  --hero:#36243c;
  --green:#36243c;
  --green-dark:#241729;
  --accent:#ffb79a;
  --lime:#ffb79a;
  --cream:#faf5f2;
  --bg:#faf5f2;
  --muted:#7c6d76;
  --line:#e8dce2;
  --soft:#f2e8ec;
  --surface:#fffdfb;
  --accent-soft:#f9e7df;
  --accent-border:#edc9b9;
  --focus:#81526b;
  --on-hero:#fff9f3;
  --muted-on-hero:#e0d2de;
  --line-on-hero:#68516e;
  --shadow:#30233212;
  --warning-bg:#faebdf;
  --warning-ink:#805139;
  --danger-bg:#f8e6e3;
  --danger-ink:#943e3c;
}
html[data-theme="cobalt"] {
  --ink:#182544;
  --hero:#1b2f57;
  --green:#1b2f57;
  --green-dark:#10213f;
  --accent:#b5d2ff;
  --lime:#b5d2ff;
  --cream:#f5f7fc;
  --bg:#f5f7fc;
  --muted:#64728c;
  --line:#dce3f1;
  --soft:#e8eef8;
  --surface:#fdfefe;
  --accent-soft:#e8f0ff;
  --accent-border:#c3d6f6;
  --focus:#416bab;
  --on-hero:#f8fbff;
  --muted-on-hero:#d0def2;
  --line-on-hero:#52688d;
  --shadow:#18254412;
}
html[data-theme="sage"] {
  --ink:#1e382f;
  --hero:#1d3c31;
  --green:#1d3c31;
  --green-dark:#122b22;
  --accent:#bce3c7;
  --lime:#bce3c7;
  --cream:#f5f7f2;
  --bg:#f5f7f2;
  --muted:#617367;
  --line:#dce6dc;
  --soft:#e8f0e7;
  --surface:#fdfffb;
  --accent-soft:#e3f2e5;
  --accent-border:#c1ddc6;
  --focus:#4d7a5f;
  --on-hero:#f7fcf6;
  --muted-on-hero:#d3e4d9;
  --line-on-hero:#526e60;
  --shadow:#1e382f12;
}
html[data-theme="lime"] {
  --ink:#191b16;
  --hero:#23281e;
  --green:#20251c;
  --green-dark:#0e120b;
  --accent:#dcf768;
  --lime:#dcf768;
  --cream:#f5f3ed;
  --bg:#f5f3ed;
  --muted:#69705e;
  --line:#e2e2d8;
  --soft:#eeeee5;
  --surface:#fffefb;
  --accent-soft:#edf3db;
  --accent-border:#d7e2bc;
  --focus:#606e25;
  --on-hero:#f9fbed;
  --muted-on-hero:#d1d8c4;
  --line-on-hero:#565e48;
  --shadow:#191b1612;
}

html,body{background:var(--cream);color:var(--ink)}
::selection{background:var(--accent);color:var(--ink)}
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,
select:focus-visible,textarea:focus-visible{outline-color:var(--focus)}

/* The header is opaque. No filter/transform may contain its fixed mobile nav. */
.topbar,.at-home .topbar{background:var(--cream);border-color:var(--line);backdrop-filter:none;-webkit-backdrop-filter:none;filter:none}
.topbar .brand{display:inline-flex;text-transform:none;align-items:center;gap:7px;color:var(--ink);min-width:0;text-decoration:none}
.brand-mascot{display:block;width:52px;height:52px;object-fit:contain;flex:none;filter:none;mix-blend-mode:normal}
.brand-wordmark{display:inline-block;font-weight:800;letter-spacing:-1.8px;line-height:1;white-space:nowrap}
.brand-dot{color:var(--ink)}
.brand-dot:after{background:var(--accent)}
.topbar .nav{color:var(--muted)}
.topbar .nav.active{background:var(--hero);color:var(--on-hero)}
.header-history,.area-trigger,.appearance-trigger{background:var(--cream);border:1px solid var(--line);color:var(--ink);min-height:44px}
.appearance-trigger{display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;padding:10px;border-radius:50%;cursor:pointer}
.appearance-trigger svg{display:block;width:20px;height:20px;flex:none}
.header-history.active,.appearance-trigger[aria-expanded="true"]{background:var(--soft);color:var(--ink)}
.header-history #navCount{background:var(--hero);color:var(--on-hero);border-color:var(--cream)}
.topbar .scan-header{background:var(--hero);color:var(--accent)}

/* Shared text hierarchy, including the previously fixed olive secondary text. */
.home-kicker,.screen-kicker,.home-view .home-heading p,.home-view .home-upload,
.tickets-view .home-upload,.home-section-heading .home-text-button,
.home-view .home-list-card>strong>span,.home-view .home-receipt-copy small,
.home-view .home-receipt-total small,.home-area-card small,.home-empty-note,
.ticket-comparison-heading p,.comparison-location small,.photo-comparison .store-quantity,
.pair-price-caption,.photo-comparison .pair-price-caption,.store-arrow,.list-pair-arrow,
.list-difference,.list-note,.ticket-card-details>summary,.habits-view .habit-detail>summary,
.ticket-card-details div,.habit-detail-body,.comparison-export,.source-note,
.habits-view .habits-counters,.list-item-heading,.list-check,.list-product p,.list-product>small,
.habits-view .simple-list-item .list-quantity,.tickets-heading p,.tickets-item-copy p,
.picker-intro p,.picker-original-price small,.picker-hint,.replacement-product p,
.replacement-cash span,.replacement-detail,.area-intro,.area-store-copy p,.area-note,
.scan-intro p,.form-grid label,.form-help,.page-footer,.page-footer>span span,
.receipt-chip small,.price-caption,.product-format,.local-note,
.modal-intro,.source-item p,.ticket-meta,.ticket-line small,.ticket-annotation,
.scan-intro p.scan-privacy,.import-row label,.receipt-row-status,
.habits-footnote,.habit-empty,.comparison-empty{color:var(--muted)}
.home-view .home-heading h1,.home-view .home-heading h1 span,
.photo-comparison .pair-product-name,.list-product h4,.photo-comparison .store-label,
.list-store,.ticket-comparison-heading h2,.habits-view .habits-intro h2,
.tickets-view h1,.review-card h2,.product-name,.ticket-line,.ticket-final,
.replacement-product h3,.replacement-cash strong,.picker-intro h3{color:var(--ink)}
.photo-caption{color:var(--muted)!important}
.photo-comparison .original-side .store-label,.list-store.is-coop{color:#b85c20}
.home-kicker:before,.screen-kicker:before{background:var(--focus);box-shadow:0 0 0 4px var(--soft)}
.text-button,.ticket-card-details .text-button,.source-note button,.source-links,
.local-retailer-link,.area-back,.area-retailer-context button,.comparison-location button,
.tickets-remove,.ticket-delete-link{color:var(--ink)}

/* Hero, totals and primary actions share one dark ink, independent of theme. */
.home-view .hero-wallet,.comparison-summary{background:var(--hero);color:var(--on-hero)}
.hero-wallet:after{border-color:var(--line-on-hero);box-shadow:0 0 0 32px #ffffff04,0 0 0 64px #ffffff03}
.wallet-label,.wallet-bottom,.comparison-summary p,.comparison-summary small{color:var(--muted-on-hero)}
.wallet-caption{color:var(--on-hero)}
.wallet-bottom{border-color:var(--line-on-hero)}
.wallet-amount,.comparison-summary strong{color:var(--accent)}
.wallet-sticker,.wallet-bottom .wallet-arrow,.summary-mark,.scan-icon{background:var(--accent);color:var(--ink)}
.wallet-sticker img{width:72%;height:72%;object-fit:contain;filter:none;mix-blend-mode:normal}
.home-view .home-camera,.tickets-view .home-camera,.button.primary,
.home-view .home-draft-button,.tickets-open{background:var(--hero);border-color:var(--hero);color:var(--accent)}
.home-view .home-camera:hover,.tickets-view .home-camera:hover,.button.primary:hover,
.home-view .home-draft-button:hover,.tickets-open:hover{background:var(--green-dark);border-color:var(--green-dark)}
.button.secondary,.coop-card-bottom>.button,.habits-view .simple-list-item .habit-rechoose{background:var(--surface);border-color:var(--line);color:var(--ink)}
.button.secondary:hover,.coop-card-bottom>.button:hover,.habits-view .simple-list-item .habit-rechoose:hover{background:var(--soft)}
.button.soft{background:var(--soft);color:var(--ink)}

/* Quiet paper surfaces; no green leaks behind products or stored receipts. */
.home-view .home-list-card,.ticket-tools .receipt-chip,.ticket-overview .receipt-chip,
.photo-comparison.coop-product,.habits-view .simple-list-item,.comparison-save-bar,
.tickets-view .tickets-item,.replacement-card,.replacement-photo,.review-card,
.product-card,.product-visual,.original-receipt,.summary-card,.queue-card,
.import-row,.receipt-review-row,.receipt-scan-preview,.raw-receipt,.review-photo,
.option-card,.ticket-history-list .history-ticket{background:var(--surface);border-color:var(--line)}
.home-view .home-list-france,.photo-comparison .france-side,.list-product:nth-child(3),
.product-card.proposal,.home-view .home-draft{background:var(--accent-soft);border-color:var(--accent-border)}
.home-view .home-list-france>strong>span,.photo-comparison .france-side .store-quantity,
.photo-comparison .france-side .pair-price-caption,.list-product:nth-child(3) p,
.list-product:nth-child(3)>small,.replacement-card.is-current .replacement-product p,
.replacement-card.is-current .replacement-cash span,.product-card.proposal .product-format,
.product-card.proposal .price-caption,.retailer-lead p,.rate-box p,.review-details{color:var(--ink)}
.home-receipt-icon{background:var(--surface);border-color:var(--line);color:var(--ink)}
.home-area-icon,.tickets-item-icon,.area-store-mark,.modal-head .icon-button,
.rate-box,.review-details,.retailer-lead,.equivalence-label{background:var(--soft);border-color:var(--line);color:var(--ink)}
.home-view .home-pending{color:var(--warning-ink)}
.home-pending-dot{background:var(--warning-ink)}
.home-view .home-receipt,.home-area-card,.tickets-backup,.area-store,.picker-swiss,
.picker-extra,.habits-view .habits-disclosure,.page-footer,.source-item,
.ticket-line,.ticket-final,.import-meta,.import-sum,.raw-receipt,.review-photo{border-color:var(--line)}
.habits-view .habits-disclosure{color:var(--ink)}
.habits-view .is-checked{background:var(--soft)}
.comparison-photo img,.list-product-photo img{filter:drop-shadow(0 5px 4px var(--shadow))}
.photo-comparison.coop-product,.habits-view .simple-list-item{box-shadow:0 3px 0 var(--shadow)}
.list-check input[type="checkbox"]{accent-color:var(--hero)}

/* Selected choices are outlined as well as colored. */
.comparison-filters button,.habits-view .habits-tabs button,.picker-store-filters button,
.area-tabs button,.queue-filters button,.quantity-choices button{background:transparent;border-color:var(--line);color:var(--muted)}
.comparison-filters button[aria-pressed="true"],.habits-view .habits-tabs button.active,
.picker-store-filters button[aria-pressed="true"],.area-tabs button[aria-pressed="true"],
.quantity-choices button.active{background:var(--hero);border-color:var(--hero);color:var(--on-hero)}
.replacement-card.is-current,.option-card.active{background:var(--accent-soft);border-color:var(--focus)}
.selected-label,.selected-label.muted{background:var(--soft);color:var(--ink)}
.replacement-top .offer-retailer{color:var(--ink)}
.photo-comparison.is-cheaper .coop-product-heading>small{color:var(--ink)}
.coop-product .tradeoff,.habits-view .habit-purchase{background:var(--accent);color:var(--ink)}
.replacement-card .tradeoff,.better-offer-button{background:var(--accent-soft);border-color:var(--accent-border);color:var(--ink)}
.coop-product .tradeoff.costlier,.habits-view .habit-purchase.is-higher,
.replacement-card .tradeoff.costlier,.usage-offer-button{background:var(--warning-bg);color:var(--warning-ink)}
.habits-view .habit-purchase>small{color:var(--ink)}
.habits-view .habit-purchase.is-higher>small{color:var(--warning-ink)}
.usage-tag,.offer-difference{color:var(--warning-ink)}

/* Dialogs, editing and imports inherit the active palette too. */
dialog{background:var(--cream);color:var(--ink);box-shadow:0 24px 110px #1e17253d}
dialog::backdrop{background:#1d14235c}
.modal-head,.choice-modal .modal-head{background:var(--cream);border-color:var(--line)}
.modal-head h2{color:var(--ink)}
.modal-head:before{background:var(--line)}
.modal-body{color:var(--ink)}
.area-store>a{background:var(--surface);border-color:var(--line);color:var(--ink)}
.area-empty{border-color:var(--line);color:var(--muted)}
.habits-view .habits-search input,.modal-body input:not([type="file"]),
.modal-body select,.modal-body textarea,input:not([type="file"]),select,textarea{background:var(--surface);border-color:var(--line);color:var(--ink)}
input::placeholder,textarea::placeholder,.habits-view .habits-search input::placeholder{color:var(--muted);opacity:1}
.form-error,.receipt-row-reasons .is-blocking,.import-sum.has-mismatch{color:var(--danger-ink)}
.receipt-review-row.has-error{border-color:var(--danger-ink);background:var(--surface)}
.receipt-optional,.receipt-review-row .receipt-optional,.receipt-review-row summary,
.receipt-row-editor,.receipt-save-bar,.scan-import-actions{background:var(--cream);border-color:var(--line);color:var(--ink)}
.receipt-optional>summary,.receipt-row-edit,.receipt-row-fields label,
.receipt-match-field,.receipt-optional label{color:var(--ink)}
.scan-progress,.progress-track{background:var(--soft)}
.scan-progress>div,.progress-track>div{background:var(--focus)}
.scan-photo-frame,.scan-loading .scan-photo-frame{background:var(--soft)}
.queue-item.selected{background:var(--accent-soft);border-color:var(--accent-border)}
.queue-name,.queue-heading h2,.queue-bottom{color:var(--ink)}
.queue-sub,.queue-heading p,.summary-top,#summaryExplanation,.summary-conversion{color:var(--muted)}
.summary-value,.saving-line strong{color:var(--ink)}
.toast{background:var(--hero);color:var(--on-hero);box-shadow:0 8px 28px var(--shadow)}
.toast button{color:var(--accent)}

/* Four previews remain recognizable while the page palette changes live. */
.theme-picker{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;padding:3px 0 8px}
.theme-choice{--preview-ink:#36243c;--preview-accent:#ffb79a;--preview-cream:#faf5f2;--preview-soft:#f2e8ec;position:relative;display:flex;flex-direction:column;gap:0;min-width:0;padding:7px 7px 13px;border:2px solid var(--line);border-radius:20px;background:var(--surface);color:var(--ink);text-align:left;cursor:pointer;overflow:hidden}
.theme-choice[data-theme-option="cobalt"]{--preview-ink:#1b2f57;--preview-accent:#b5d2ff;--preview-cream:#f5f7fc;--preview-soft:#e8eef8}
.theme-choice[data-theme-option="sage"]{--preview-ink:#1d3c31;--preview-accent:#bce3c7;--preview-cream:#f5f7f2;--preview-soft:#e8f0e7}
.theme-choice[data-theme-option="lime"]{--preview-ink:#23281e;--preview-accent:#dcf768;--preview-cream:#f5f3ed;--preview-soft:#eeeee5}
.theme-choice:hover{border-color:var(--focus)}
.theme-choice[aria-pressed="true"],.theme-choice.is-selected{border-color:var(--hero);box-shadow:0 0 0 1px var(--hero)}
.theme-choice[aria-pressed="true"]:after,.theme-choice.is-selected:after{content:"✓";position:absolute;top:13px;right:13px;display:grid;place-items:center;width:24px;height:24px;border:2px solid var(--surface);border-radius:50%;background:var(--hero);color:var(--on-hero);font-size:13px;font-weight:800;line-height:1;z-index:2}
.theme-preview{display:block;position:relative;isolation:isolate;width:100%;height:106px;border-radius:13px;overflow:hidden;background:var(--preview-cream);pointer-events:none}
.theme-preview:before{content:"";position:absolute;left:12px;right:12px;top:19px;height:49px;border-radius:10px;background:var(--preview-ink);box-shadow:0 62px 0 -17px var(--preview-ink)}
.theme-preview:after{content:"";position:absolute;left:22px;top:31px;width:42%;height:7px;border-radius:4px;background:var(--preview-accent);box-shadow:0 13px 0 -1px var(--preview-accent)}
.theme-preview .theme-preview-header,.theme-preview .theme-preview-bar{position:absolute;left:14px;top:8px;width:30px;height:4px;border-radius:4px;background:var(--preview-ink)}
.theme-preview .theme-preview-card{position:absolute;left:12px;right:12px;top:76px;height:12px;border-radius:5px;background:var(--preview-soft)}
.theme-choice-name{display:block;padding:11px 6px 2px;font-size:14px;font-weight:800;line-height:1.4;letter-spacing:-.3px;color:var(--ink)}
.theme-choice-caption{display:block;padding:0 6px;font-size:11px;font-weight:500;line-height:1.5;color:var(--muted)}
.theme-picker-note,.appearance-note{color:var(--muted);font-size:12px;line-height:1.6;margin:10px 0 0}

@media (min-width:681px) and (max-width:1050px){
  .topbar,.at-home .topbar{padding-left:18px;padding-right:18px;gap:12px}
  .topbar .brand{font-size:26px;gap:5px}
  .brand-mascot{width:44px;height:44px}
  .topbar nav{gap:1px}
  .topbar .nav{padding:10px 11px;font-size:11px;gap:5px}
  .topbar .nav span.nav-label{font-size:11px}
  .topbar .header-actions{gap:5px}
  .area-trigger{padding:8px 10px;font-size:11px;max-width:112px}
}
@media (min-width:681px) and (max-width:780px){
  .topbar .brand{font-size:24px;gap:4px}
  .brand-mascot{width:42px;height:42px}
  .topbar .nav{padding:10px 7px;gap:4px}
  .topbar .header-actions{gap:3px}
  .area-trigger{max-width:88px;padding:8px 7px;font-size:10px}
}
@media (max-width:680px){
  .topbar,.at-home .topbar{padding-left:16px;padding-right:16px;gap:10px;background:var(--cream);border-color:var(--line);backdrop-filter:none;-webkit-backdrop-filter:none}
  .topbar .brand{font-size:27px;gap:6px;flex:none}
  .brand-mascot{width:48px;height:48px}
  .brand-wordmark{letter-spacing:-1.6px}
  .topbar .header-actions{margin-left:auto;gap:5px;min-width:0}
  .area-trigger{max-width:102px;min-height:44px;gap:4px;padding:8px 9px;font-size:10px}
  .header-history,.appearance-trigger{width:44px;height:44px;min-height:44px;padding:10px;flex:none}
  .topbar .scan-header{display:none}
  .topbar nav{background:var(--hero);border-color:var(--hero);box-shadow:0 8px 30px var(--shadow);backdrop-filter:none;-webkit-backdrop-filter:none}
  .topbar .nav{color:var(--muted-on-hero)}
  .topbar .nav.active{background:var(--accent);color:var(--ink)}
  .wallet-bottom .wallet-arrow{background:none;color:var(--accent)}
  .home-view .hero-wallet{height:auto;min-height:151px}
  .home-view .wallet-empty{min-height:174px}
  .home-view .home-upload{min-height:44px}
  .home-kicker:before,.screen-kicker:before{box-shadow:0 0 0 3px var(--soft)}
  .theme-picker{gap:10px}
  .theme-choice{border-radius:17px;padding:6px 6px 12px}
  .theme-preview{height:98px;border-radius:11px}
  .theme-choice-name{font-size:13px;padding-top:10px}
  .theme-choice-caption{font-size:11px}
  .modal-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .modal-body select,.modal-body textarea,.habits-view .habits-search input{font-size:16px;min-height:44px}
  .receipt-row-fields label,.receipt-match-field,.receipt-optional label{font-size:12px}
}
@media (max-width:380px){
  .topbar,.at-home .topbar{padding-left:12px;padding-right:12px;gap:6px}
  .topbar .brand{font-size:23px;gap:4px}
  .brand-mascot{width:42px;height:42px}
  .brand-wordmark{letter-spacing:-1.2px}
  .topbar .header-actions{gap:3px}
  .area-trigger{max-width:79px;padding:8px 6px;gap:3px;font-size:10px}
  .area-trigger svg{width:12px;height:12px}
  .area-trigger .area-chevron{width:8px;height:8px}
  .header-history,.appearance-trigger{width:40px;height:44px;min-height:44px;padding:9px}
  .appearance-trigger svg,.header-history svg{width:20px;height:20px}
  .theme-picker{gap:9px}
  .theme-choice-name,.theme-choice-caption{padding-left:4px;padding-right:4px}
}
@media (prefers-reduced-motion:no-preference){
  .theme-choice,.appearance-trigger{transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease}
}

@media(max-width:350px){.topbar .area-trigger{width:40px;min-width:40px;justify-content:center;padding:8px}.topbar .area-trigger #areaLabel,.topbar .area-chevron{display:none}}
