/* The phone and iPad app (html.app-mode, set by shell.js; never on the website). Phones and iPad portrait use a bottom
   tab bar; iPad landscape and wider use a sidebar. Colors are tokens so dark mode is one override. */
.app-mode{--surface:#fffdf8;--surface-2:#ffffff;--chip:#ffffff;--field:#ffffff;--shade:#18352214;--tab:#6d7b72;--accent-wash:#eaf5ed;--warn:#7a4c00;--warn-wash:#fdecc8;color-scheme:light}


/* ---- What the app no longer shows ---- */
.app-mode .legacy-hero,.app-mode #metrics,.app-mode .history-privacy,.app-mode #history-insights>h2,.app-mode #history-insights>small,
.app-mode .sales-hero .eyebrow,.app-mode .sales-hero h1,.app-mode .account-tabs,.app-mode .system-head,.app-mode #import-hint,
.app-mode .appbar-title,.app-mode .web-nav,.app-mode #browser-mode-note,.app-mode #sales-view>.sales-count{display:none!important}
.app-mode #coupons-view>.toolbar{display:none}

/* ---- Top bar: logo and wordmark, account on the right ---- */
.app-mode .appbar{height:56px;justify-content:space-between;padding:0 14px;position:sticky;top:0}
.app-mode .appbar .brand{position:static;transform:none;display:flex;flex:none;font-size:17px;gap:9px;white-space:nowrap}
.app-mode .appbar .brand>span:last-child{display:inline}
.app-mode .appbar .brand-mark{width:32px;height:32px}
.account-button{display:none}
.app-mode .account-button{display:grid;place-items:center;width:40px;height:40px;padding:0;border-radius:50%;border:2px solid #ffffff55;background:#ffffff22;color:#fff;font-weight:900;font-size:16px;cursor:pointer;flex:none}
.app-mode .account-button:not(.signed-in){background:#ffffff22 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c.6-3.6 3.8-6 8-6s7.4 2.4 8 6'/%3E%3C/svg%3E") no-repeat center/20px}
.app-mode .account-button.signed-in{background:#fff;color:var(--green-dark);border-color:#fff}
.app-mode .account-button.active{box-shadow:0 0 0 3px #ffffff88}

/* ---- Bottom tab bar (phones and iPad portrait) ---- */
@media(max-width:1023px){
  .app-mode .appbar nav{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;justify-content:space-around;gap:0;min-height:0;height:auto;align-self:auto;background:var(--surface-2);box-shadow:0 -1px 0 var(--line),0 -4px 14px #102c1e14;padding:6px 6px calc(max(env(safe-area-inset-bottom,0px),10px) + 4px)}
  .app-mode .appbar .nav-item{flex:1;max-width:160px;min-height:0;display:flex;flex-direction:column;align-items:center;gap:3px;padding:2px 2px 0;border:0;opacity:1;color:var(--tab);font-size:11.5px;font-weight:650;background:transparent}
  .app-mode .appbar .nav-item .nav-icon{display:block;width:48px;height:30px;padding:3px 12px;border-radius:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;box-sizing:border-box}
  .app-mode .appbar .nav-item.active{color:var(--green);font-weight:800}
  .app-mode .appbar .nav-item.active .nav-icon{background:var(--accent-wash);stroke-width:2.2}
  .app-mode main{margin-bottom:calc(92px + env(safe-area-inset-bottom,0px))}
}

/* ---- Content width ---- */
.app-mode main{width:min(1080px,calc(100% - 28px));margin-left:auto;margin-right:auto}
.app-mode .view{padding-top:18px}

/* ---- Screen titles: one per screen ---- */
.screen-intro{margin:6px 0 14px}
.screen-intro h1,.deals-head h1,.app-mode .setup-head h1{font:700 32px/1.08 "Fraunces",Georgia,serif;letter-spacing:-.02em;margin:2px 0 6px;color:var(--ink)}
.screen-intro p{color:var(--muted);margin:0;font-size:15px;max-width:640px}
.screen-intro.with-action{display:flex;gap:14px;align-items:flex-start;justify-content:space-between}
.app-mode .setup-head{margin-bottom:6px}
.app-mode #system-view>.setup-head,.app-mode #system-view>.setup-head h1{display:block!important}
.app-mode .setup-head p{display:none}
.section-note{color:var(--muted);font-size:13.5px;margin:4px 0 10px}
.linkish{border:0;background:none;padding:8px 2px;min-height:40px;color:var(--green);font:inherit;font-weight:750;cursor:pointer}

/* ---- Deals: title and the Coupons / Weekly ads switch ---- */
.deals-head{padding-top:18px}
.deals-head h1{margin-bottom:12px}
.segmented{display:flex;background:var(--accent-wash);border-radius:12px;padding:4px;gap:4px;max-width:420px}
.segmented button{flex:1;min-height:40px;border:0;border-radius:9px;background:transparent;color:var(--muted);font-weight:750;font-size:15px}
.segmented button[aria-selected="true"],.segmented button[aria-checked="true"]{background:var(--surface-2);color:var(--ink);box-shadow:0 1px 4px var(--shade)}
.app-mode #coupons-view,.app-mode #sales-view{padding-top:12px}

/* ---- Coupons ---- */
.app-mode #coupons-view .search-shell,.app-mode #sales-view .search-shell{height:48px;box-shadow:none;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.app-mode #sales-view .sales-toolbar{background:transparent;position:static;padding:4px 0 0}
.app-mode #retailer-chips{padding-bottom:2px}
/* One store chip everywhere (Coupons, Weekly ads, Checkout): logo, name, count. */
.app-mode #retailer-chips .chip,.app-mode #sales-chips .chip,.app-mode #checkout-retailer-chips .chip{display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:0 14px;font-size:14.5px;font-weight:700;border-radius:999px}
.app-mode #retailer-chips .retailer-icon,.app-mode #sales-chips .retailer-icon,.app-mode #checkout-retailer-chips .retailer-icon{width:18px;height:18px;border-radius:5px;margin:0;vertical-align:0}
.app-mode #sales-chips{padding:10px 1px 4px}
.quick-chips{padding-top:6px!important}
.quick-chips .chip{padding:7px 12px;font-size:14px}
.chip-count{opacity:.6;font-weight:650;margin-left:2px}
.chip.active .chip-count{opacity:.85}
.filter-chip{border-style:dashed!important}
.app-mode #coupons-view .feed-actions{display:flex;align-items:center;gap:10px;margin:8px 0 4px;flex-wrap:wrap}
.app-mode #coupons-view .feed-actions>small{display:none}
.coupon-summary{flex:1;min-width:150px;color:var(--muted);font-size:14px;font-weight:650}
.app-mode #coupons-view .feed-buttons{display:flex;gap:8px;margin-left:auto}
.app-mode #sync-all{min-height:40px;padding:0 14px;font-size:14px}
.app-mode #bulk-clip{min-height:40px;padding:0 16px;font-size:14px}
.app-mode #deals{display:block;margin-top:0}
.coupon-list{display:grid;grid-template-columns:1fr;gap:10px;margin-top:10px}
.coupon-row{display:grid;grid-template-columns:64px 1fr auto;gap:12px;align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:10px 10px 10px 10px;min-width:0}
.coupon-row.is-clipped{background:color-mix(in srgb,var(--surface) 88%,var(--green) 12%)}
.coupon-thumb{width:64px;height:64px;border-radius:12px;background:#fff;display:grid;place-items:center;overflow:hidden}
.coupon-thumb img{width:100%;height:100%;object-fit:contain}
.coupon-thumb img.missing{display:none}
.coupon-thumb .retailer-icon{width:34px;height:34px;border-radius:8px}
.coupon-body{min-width:0}
.coupon-meta{display:flex;align-items:center;gap:5px;font-size:12px;color:var(--muted);font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.coupon-meta .retailer-icon{width:16px;height:16px;border-radius:4px;flex:none}
.coupon-meta .urgent{color:var(--red);font-weight:800}
.dot-sep{opacity:.6}
.coupon-title{display:block;font-size:16px;line-height:1.25;margin:2px 0 1px;color:var(--ink)}
.coupon-desc{margin:0;color:var(--muted);font-size:13.5px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.badge{display:inline-block;margin-top:5px;font-size:11.5px;font-weight:800;color:var(--warn);background:var(--warn-wash);border-radius:999px;padding:2px 8px}
.coupon-actions{display:flex;flex-direction:column;align-items:center;gap:6px}
.clip-toggle{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-width:76px;min-height:40px;padding:0 14px;border-radius:999px;border:0;background:var(--green);color:#fff;font-weight:800;font-size:14.5px;cursor:pointer}
.clip-toggle svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.clip-toggle.is-clipped{background:var(--accent-wash);color:var(--green-dark);border:1px solid color-mix(in srgb,var(--green) 35%,transparent)}
.clip-toggle.static{cursor:default}
.clip-toggle:disabled{opacity:1}
.icon-only{width:36px;height:36px;min-height:0;padding:0;display:grid;place-items:center;border-radius:50%;border:0;background:transparent;color:var(--muted)}
.icon-only svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.app-mode .load-more{display:block;margin:16px auto 0;min-height:44px;padding:0 20px}.app-mode .load-more[hidden]{display:none}
.empty-state{grid-column:1/-1;text-align:center;background:var(--surface);border:1px dashed var(--line);border-radius:18px;padding:28px 20px;color:var(--muted)}
.empty-state strong{display:block;color:var(--ink);font-size:17px;margin-bottom:4px}
.empty-state p{margin:0 0 14px}
.empty-state.inline{padding:18px}
.app-mode #coupon-filters-dialog .toolbar{display:grid;grid-template-columns:1fr;gap:10px;margin:14px 0}
.app-mode #coupon-filters-dialog select{height:48px;width:100%;min-width:0}
.app-mode #coupon-filters-dialog #retailer{display:none}

/* Bottom sheets on phones. */
@media(max-width:767px){
  .app-mode dialog.sheet{position:fixed;inset:auto 0 0 0;margin:0;width:100%;max-width:none;max-height:88vh;overflow:auto;border-radius:22px 22px 0 0;border-bottom:0;padding:20px 18px calc(22px + env(safe-area-inset-bottom,0px))}
}
.app-mode dialog.sheet .dialog-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:6px}

/* ---- Messages: a toast above the tab bar instead of a banner that pushes the screen down ---- */
.app-mode #notice{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(96px + env(safe-area-inset-bottom,0px));z-index:35;width:min(520px,calc(100% - 28px));margin:0;box-shadow:0 10px 30px #102c1e40;border-radius:14px;cursor:pointer}
@media(min-width:1024px){.app-mode #notice{bottom:24px;left:calc(50% + 116px)}}
/* Always above the dialog's contents: a dimmed (semi-transparent) store card forms its own layer and used to cover it. */
.app-mode dialog form[method="dialog"]{position:relative;z-index:5}
.app-mode .dialog-close{z-index:5;width:40px;height:40px;min-height:0;padding:0;border:0;border-radius:50%;background:var(--accent-wash);color:var(--ink);font-size:22px;line-height:1;display:grid;place-items:center}

/* ---- Home ---- */
#home-view{padding-bottom:10px}
.home-card{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:18px;margin-top:12px;box-shadow:var(--shadow)}
.home-card h2,.home-section h2{font-size:18px;margin:0 0 6px;color:var(--ink)}
.home-card p{color:var(--muted);margin:0 0 14px}
.setup-card{background:linear-gradient(135deg,var(--accent-wash),var(--surface))}
.savings-card{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.savings-card .stat strong{display:block;font:700 40px/1 "Fraunces",Georgia,serif;color:var(--green-dark)}
.savings-card .stat span{color:var(--muted);font-size:14px}
.savings-card .stat b{color:var(--ink)}
.savings-actions{grid-column:1/-1;display:flex;gap:10px}
.savings-actions button{flex:1;min-height:46px}
.home-section{margin-top:22px}
.attention-list{display:grid;gap:8px;margin-top:8px}
.attention-row{display:grid;grid-template-columns:36px 1fr auto;gap:12px;align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:10px 12px}
.attention-row .retailer-icon{width:36px;height:36px;border-radius:9px}
.attention-row small{display:block;color:var(--muted);font-size:13px}
.attention-row button{min-height:40px}
.sale-strip{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 8px;scrollbar-width:none;scroll-snap-type:x mandatory}
.sale-strip::-webkit-scrollbar{display:none}
.sale-tile{flex:0 0 148px;scroll-snap-align:start;display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:10px;color:var(--ink)}
.sale-tile img{width:100%;height:96px;object-fit:contain;background:#fff;border-radius:10px;margin-bottom:6px}
.sale-tile strong{font-size:18px;color:var(--green-dark)}
.sale-tile span{font-size:13.5px;font-weight:650;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.sale-tile small{color:var(--muted);font-size:12px}
.teaser-card{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;margin-top:22px}
.teaser-card p{margin:0}
.teaser-card button{min-height:44px}

/* ---- Checkout ---- */
.app-mode #checkout-view .setup-actions{margin:12px 0}
.app-mode #checkout-scan{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:58px;font-size:17px;border-radius:16px}
.app-mode #checkout-scan svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.app-mode #checkout-reset{width:100%;margin-top:8px;min-height:44px}
.checkout-result{display:flex;gap:14px;align-items:center;justify-content:space-between;border-radius:18px;padding:16px;margin:6px 0 10px}
.checkout-result strong{display:block;font-size:18px}
.checkout-result span{display:block;font-size:14px;margin-top:2px}
.checkout-result.found{background:var(--warn-wash);color:var(--warn)}
.checkout-result.found strong{color:var(--ink)}
.checkout-result.clear{background:var(--accent-wash);color:var(--green-dark)}
.checkout-result .primary{flex:none;min-height:46px;padding:0 18px}
.matched .matched-line{display:block;color:var(--muted);font-size:12.5px;margin:4px 6px 0}
.checkout-section{margin-top:18px}
.checkout-section h2{font-size:17px;margin:0 0 4px}
.review-row{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 12px;margin-top:8px}
.review-row small{display:block;color:var(--muted)}
details.covered summary{cursor:pointer;font-weight:750;color:var(--green-dark);padding:8px 0}
details.covered .matched{margin-top:8px}
.app-mode #checkout-card{margin:12px 0 0;background:transparent;border:0;padding:0;box-shadow:none}
.card-line{display:grid;grid-template-columns:30px 1fr auto;gap:12px;align-items:center;width:100%;min-height:60px;padding:8px 14px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:14px;color:var(--ink);font:inherit;cursor:pointer}
.card-line svg{width:28px;height:28px;fill:none;stroke:var(--ink);stroke-width:1.8;stroke-linecap:round}
.card-line strong{display:block;font-size:15.5px}
.card-line small{display:block;color:var(--muted);font-size:13px}
.card-line .card-action{font-weight:800;color:var(--green);padding:8px 4px}
.card-line .card-alt{font-weight:850;font-size:20px;letter-spacing:.04em;font-variant-numeric:tabular-nums}
.card-line.note{grid-template-columns:1fr;cursor:default;color:var(--muted);font-size:13.5px}


/* ---- Insights ---- */
.spending{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:18px;margin:4px 0 12px;box-shadow:var(--shadow)}
.spend-head strong{display:block;font:700 38px/1.05 "Fraunces",Georgia,serif;color:var(--ink);margin:4px 0}
.spend-head small{color:var(--muted)}
.spend-bars{list-style:none;padding:0;margin:14px 0 0;display:grid;gap:8px}
.spend-bars li{display:grid;grid-template-columns:96px 1fr auto;gap:10px;align-items:center;font-size:14px}
.spend-bars .bar{height:10px;background:var(--accent-wash);border-radius:6px;overflow:hidden}
.spend-bars .bar i{display:block;height:100%;background:var(--green);border-radius:6px}
.privacy-note{margin:0 0 10px;color:var(--muted);font-size:13.5px}
.privacy-note summary{cursor:pointer;font-weight:700;min-height:36px;display:flex;align-items:center}
.app-mode #history-insights .insight{background:var(--surface);border:1px solid var(--line);border-radius:16px}
.app-mode .history-toolbar{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:12px}
.app-mode .history-toolbar select{height:48px;min-width:0;width:auto}
.app-mode #purchase-history{display:grid;grid-template-columns:1fr;gap:0 12px}
@media(min-width:700px){.app-mode #purchase-history{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}}
.app-mode #purchase-history>.trips-title,.app-mode #purchase-history>.empty,.app-mode #purchase-history>.section-note{grid-column:1/-1}
.trips-title{font-size:18px;margin:18px 0 8px}
.trip{background:var(--surface);border:1px solid var(--line);border-radius:14px;margin-top:8px;overflow:hidden}
.trip summary{display:grid;grid-template-columns:30px 1fr auto;gap:10px;align-items:center;padding:12px 14px;cursor:pointer;list-style:none}
.trip summary::-webkit-details-marker{display:none}
.trip summary .retailer-icon{width:30px;height:30px;border-radius:8px}
.trip summary small{display:block;color:var(--muted);font-size:13px}
.trip ul{list-style:none;margin:0;padding:0 14px 10px}
.trip li{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-top:1px solid var(--line);font-size:14.5px}
.trip li small{color:var(--muted)}

/* ---- Account: stores first, one line each ---- */
.app-mode #system-view:not([hidden]){display:flex;flex-direction:column}
.app-mode #system-view>.setup-head{order:0}
.app-mode #setup-view{order:1;margin-top:4px;padding-top:0;border-top:0}
.app-mode #account-view{order:2}
.app-mode #app-view{order:3}
.app-mode #setup-view::before{content:"Your stores";display:block;font-size:18px;font-weight:800;margin:6px 0 8px}
.app-mode #account-view::before{content:"Sign-in & plan";display:block;font-size:18px;font-weight:800;margin:0 0 4px}
.app-mode #app-view::before{content:"Help";display:block;font-size:18px;font-weight:800;margin:0 0 4px}
.app-mode #setup-view .setup-actions{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.app-mode #connections{display:grid;gap:8px}
.store-line{display:grid;grid-template-columns:36px 1fr 20px;gap:12px;align-items:center;width:100%;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:10px 12px;color:var(--ink);cursor:pointer}
.store-line .retailer-icon{width:36px;height:36px;border-radius:9px}
.store-line strong{display:block;font-size:16px}
.store-line small{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:13px}
.store-line.is-disabled{opacity:.6}
.store-row{display:flex;align-items:stretch;gap:6px}
.store-row .store-line{flex:1;min-width:0}
.store-handle{flex:none;display:grid;place-items:center;width:40px;border-radius:14px;color:var(--muted);cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none}
.store-handle svg{width:18px;height:18px;fill:currentColor}
.store-row.dragging{position:relative;z-index:2}
.store-row.dragging .store-line{box-shadow:0 8px 24px rgba(0,0,0,.18);border-color:var(--green,#2e7d4f)}
.store-row.dragging .store-handle{cursor:grabbing;color:var(--ink)}
body.reordering{-webkit-user-select:none;user-select:none;overscroll-behavior:none}
.status-dot{width:8px;height:8px;border-radius:50%;background:#c4ccc7;flex:none}
.status-dot.on{background:#2e9d5b}
.status-dot.warn{background:#d98a00}
.chev{width:18px;height:18px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round}
.app-mode #store-sheet .connection{border:0;padding:0;background:transparent;box-shadow:none;display:block}
.app-mode #store-sheet .connection .actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:14px}
.app-mode #store-sheet .connection .actions button{min-height:46px;width:100%;color:var(--green);font-weight:750;background:var(--field,#fff);border:1px solid var(--line);border-radius:12px}
.app-mode #store-sheet .connection .actions [data-remove-retailer]{color:var(--red)}
.app-mode #store-sheet .connection-head strong{font-size:20px}
.app-mode #store-sheet small{display:block;color:var(--muted);margin-top:4px}
.app-mode #store-sheet .store-address a{color:var(--muted);text-decoration:none}
.app-mode .store-address a{color:var(--muted);text-decoration:none}

/* ---- Onboarding ---- */
.onboarding{position:fixed;inset:0;z-index:40;background:var(--wash);display:flex;align-items:center;justify-content:center;padding:max(20px,env(safe-area-inset-top)) 16px max(20px,env(safe-area-inset-bottom));overflow:auto}
.onboarding[hidden]{display:none}
.onboarding-open .appbar,.onboarding-open main{visibility:hidden}
.ob-card{width:min(520px,100%);display:flex;flex-direction:column;gap:12px}
.ob-card.tall{min-height:min(760px,100%)}
.ob-card h1{font:700 34px/1.08 "Fraunces",Georgia,serif;letter-spacing:-.02em;margin:4px 0 0;color:var(--ink)}
.ob-card p{color:var(--muted);margin:0}
.ob-mark{width:72px;height:72px;border-radius:20px;box-shadow:0 6px 20px var(--shade)}
.ob-progress{display:flex;gap:6px}
.ob-progress i{flex:1;height:4px;border-radius:2px;background:var(--line)}
.ob-progress i.on{background:var(--green)}
.ob-points{list-style:none;padding:0;margin:4px 0 8px;display:grid;gap:12px}
.ob-points li{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:12px 14px;color:var(--muted)}
.ob-points b{color:var(--ink)}
.wide{width:100%;min-height:52px;font-size:16px;border-radius:14px}
.ob-search{height:48px;box-shadow:none}
.ob-search input{width:100%;background:transparent}
.ob-stores{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-height:50vh;overflow:auto;padding:2px}
.ob-store{display:grid;grid-template-columns:30px 1fr 22px;gap:8px;align-items:center;text-align:left;min-height:52px;padding:8px 10px;border-radius:12px;background:var(--surface);border:1px solid var(--line);color:var(--ink);font-weight:700}
.ob-store .retailer-icon{width:30px;height:30px;border-radius:8px}
.ob-check{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);display:grid;place-items:center}
.ob-check svg{width:14px;height:14px;fill:none;stroke:#fff;stroke-width:3.4;stroke-linecap:round;stroke-linejoin:round;opacity:0}
.ob-store.picked{border-color:var(--green);background:var(--accent-wash)}
.ob-store.picked .ob-check{background:var(--green);border-color:var(--green)}
.ob-store.picked .ob-check svg{opacity:1}
.ob-footer{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:4px;padding-top:8px}
@media(max-width:380px){.ob-stores{grid-template-columns:1fr}}

/* ---- iPad and wider ---- */
@media(min-width:700px){
  .coupon-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .savings-card{grid-template-columns:1fr 1fr auto;align-items:center}
  .savings-actions{grid-column:auto;flex-direction:column;min-width:200px}
  .attention-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .screen-intro h1,.deals-head h1,.app-mode .setup-head h1{font-size:40px}
  .app-mode #system-view{max-width:760px}
  .spending{display:grid;grid-template-columns:minmax(220px,1fr) 1.4fr;gap:24px;align-items:center}
  .spend-bars{margin-top:0}
  .ob-stores{grid-template-columns:repeat(3,1fr)}
  .ob-card{width:min(640px,100%)}
}
/* iPad landscape and wider: a sidebar instead of the bottom tab bar. */
@media(min-width:1024px){
  .app-mode .appbar{position:fixed;left:0;top:0;bottom:0;width:232px;height:auto;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:8px;padding:18px 12px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:none;border-right:1px solid #0d5234}
  .app-mode .appbar .brand{padding:4px 8px 16px}
  .app-mode .appbar nav{position:static;display:flex;flex-direction:column;gap:4px;align-self:stretch;background:transparent;box-shadow:none;padding:0;height:auto}
  .app-mode .appbar .nav-item{display:flex;flex-direction:row;align-items:center;gap:12px;min-height:48px;padding:0 12px;border:0;border-radius:12px;color:#fff;opacity:.82;font-size:16px;font-weight:700;text-align:left;background:transparent}
  .app-mode .appbar .nav-item .nav-icon{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
  .app-mode .appbar .nav-item.active{opacity:1;background:#ffffff26}
  .app-mode .account-button{margin-top:auto;width:100%;height:52px;border-radius:12px;justify-content:start;display:flex;align-items:center;gap:10px;padding:0 12px;background-position:14px center}
  .app-mode .account-button::after{content:"Account";color:#fff;font-weight:700;font-size:16px;margin-left:30px}
  .app-mode .account-button.signed-in{background:#ffffff22;color:#fff;border-color:#ffffff55}
  .app-mode .account-button.signed-in::after{margin-left:0}
  .app-mode .account-button.signed-in #account-initial{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#fff;color:var(--green-dark)}
  .app-mode main{margin-left:calc(232px + max(28px,(100% - 232px - 1080px)/2));margin-right:max(28px,(100% - 232px - 1080px)/2);width:auto;margin-bottom:40px}
  .app-mode .ptr{left:calc(50% + 116px)}
  .coupon-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  .home-sections{display:grid;grid-template-columns:1fr 1fr;gap:20px}
}
@media(min-width:1280px){.coupon-list{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* Dark mode last, so it overrides everything above. shell.js sets .dark from the Appearance choice (System follows
   prefers-color-scheme). */
.app-mode.dark{--ink:#e8efe9;--muted:#9fb0a5;--paper:#18201b;--wash:#101612;--line:#2b3a31;--green:#3fae73;--green-dark:#8fd6ab;--mint:#173323;--red:#ff8a80;--surface:#18201b;--surface-2:#1d2620;--chip:#1d2620;--field:#1d2620;--shade:#00000055;--tab:#8a9a90;--accent-wash:#173323;--warn:#ffd38a;--warn-wash:#3a2c10;--shadow:0 4px 18px #00000040;color-scheme:dark}
.app-mode.dark body{background:var(--wash)}
.app-mode.dark .appbar{background:#0f2a1c}
.app-mode.dark button,.app-mode.dark select,.app-mode.dark input,.app-mode.dark textarea{background:var(--field);color:var(--ink);border-color:var(--line)}
.app-mode.dark .primary{background:var(--green);border-color:var(--green);color:#06140c}
.app-mode.dark .chip{background:var(--chip);color:var(--ink);border-color:var(--line)}
.app-mode.dark .chip.active{background:var(--green);border-color:var(--green);color:#06140c}
.app-mode.dark .account-card,.app-mode.dark .search-shell,.app-mode.dark dialog,.app-mode.dark .retailer-dialog{background:var(--surface);color:var(--ink);border-color:var(--line)}
.app-mode.dark .notice{background:var(--mint);border-color:#2c5a3f;color:var(--green-dark)}
.app-mode.dark .notice.error{background:#3a1a18;border-color:#6b2f2a;color:var(--red)}
.app-mode.dark .setup-note{background:var(--mint);color:var(--green-dark)}
.app-mode.dark .retailer-options button{background:transparent}
.app-mode.dark .appbar nav{background:var(--surface-2)!important;box-shadow:0 -1px 0 var(--line)!important}
.app-mode.dark .gate,.app-mode.dark .gate-card{background:var(--surface)}
.app-mode.dark .gate-card .provider-buttons button.secondary{background:var(--field);color:var(--ink);border-color:var(--line)}
.app-mode.dark .appbar button.brand,.app-mode.dark .appbar .nav-item,.app-mode.dark .linkish,.app-mode.dark .icon-only,.app-mode.dark .segmented button{background:transparent}
.app-mode.dark .segmented button[aria-selected="true"],.app-mode.dark .segmented button[aria-checked="true"]{background:var(--surface-2)}
.app-mode.dark .clip-toggle{background:var(--green);color:#06140c;border:0}
.app-mode.dark .clip-toggle.is-clipped{background:var(--accent-wash);color:var(--green-dark);border:1px solid #2c5a3f}
.app-mode.dark .store-line,.app-mode.dark .ob-store,.app-mode.dark .sale-tile{background:var(--surface)}
.app-mode.dark .ob-store.picked{background:var(--accent-wash)}
.app-mode.dark .account-button.signed-in{color:#0f2a1c}

/* Sign out, in the store sheet and the Remove dialog. */
.sheet-signout{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.sheet-signout .sign-out{width:100%;min-height:46px;color:var(--red);border:1px solid color-mix(in srgb,var(--red) 40%,transparent);border-radius:12px;font-weight:750;background:transparent}
.sheet-signout .sign-out.armed{background:var(--red);color:#fff}
.sheet-note{color:var(--muted);font-size:13.5px;margin:12px 0 8px}
.remove-sign-out{display:flex;gap:10px;align-items:flex-start;margin:4px 0 14px;font-size:14px;color:var(--ink)}
.remove-sign-out[hidden]{display:none}
.remove-sign-out input{width:20px;height:20px;margin:1px 0 0;flex:none}
.sheet-status{display:flex;align-items:center;gap:8px;margin:0 0 6px;font-weight:700;color:var(--ink)}
.app-mode #store-sheet .connection .actions .sync-now{grid-column:1/-1;background:var(--green);color:#fff;border-color:var(--green)}
.app-mode #history-attention.names-card{display:flex;flex-direction:column;gap:6px;background:var(--warn-wash);border:0;border-radius:16px;color:var(--warn);padding:14px 16px;margin:4px 0 12px}
.app-mode #history-attention.names-card strong{color:var(--ink);font-size:16px}
.app-mode #history-attention.names-card span{font-size:14px}
.app-mode #history-attention.names-card .names-error{font-size:12.5px;opacity:.85;word-break:break-word}
.app-mode #history-attention.names-card button{align-self:flex-start;margin-top:4px;min-height:42px}
.trip li.nameless{color:var(--muted);font-style:italic}
#appearance-card .segmented{margin:4px 0 8px}
.app-mode dialog:focus{outline:none}
.app-mode .dialog-close:focus-visible{outline:2px solid var(--green);outline-offset:-3px}

/* Shopping list (list.js) */
.list-status{color:var(--muted);font-size:14px;margin:6px 0 0;min-height:1em}
.list-empty{color:var(--muted);margin:18px 0}
.list-view-switch{margin:14px 0 4px}
.list-section{margin:18px 0}
.list-section h2{font-size:18px;margin:0 0 6px;display:flex;align-items:center;gap:8px}
.list-section h2 .count{font-size:13px;font-weight:750;background:var(--accent-wash);color:var(--green-dark);border-radius:999px;padding:1px 9px}
.list-store-detail{color:var(--muted);font-size:13.5px;margin:-2px 0 4px}
.list-store-total{color:var(--muted);font-size:14px;margin:0 0 8px}
.list-items{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.list-item{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:12px 14px;display:flex;flex-direction:column;gap:10px}
.list-item-head{display:flex;align-items:center;gap:10px}
.list-item-name{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.list-item-name strong{font-size:17px;line-height:1.25}
.list-item-name small{color:var(--muted);font-size:13.5px}
.list-check input{width:24px;height:24px;margin:0;accent-color:var(--green)}
.list-qty{display:inline-flex;align-items:center;gap:6px;flex:none}
.list-qty button{width:30px;height:30px;min-height:0;padding:0;border-radius:50%;border:1px solid var(--line);background:var(--field);font-size:17px;line-height:1}
.list-qty b{min-width:1.2em;text-align:center}
.list-remove{flex:none;font-size:14px;color:var(--muted);background:transparent;border:0;padding:0 2px;min-height:30px;font-weight:650}
.list-choice{display:flex;gap:12px;align-items:flex-start;margin-left:34px;padding-left:12px;border-left:3px solid var(--accent-wash)}
.list-choice img{width:52px;height:52px;object-fit:contain;border-radius:10px;background:#fff;flex:none}
.list-choice-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.list-choice-head{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.list-choice-head strong{font-size:15px;line-height:1.3;font-weight:700}
.list-choice-head b{font-size:16px;flex:none}
.list-choice small{color:var(--muted);font-size:13.5px}
.list-choice .list-deal{color:var(--green-dark)}
.list-item.is-checked{opacity:.55}
.list-item.is-checked .list-item-name strong{text-decoration:line-through}
.list-actions{display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center;margin-top:2px}
.list-actions a,.list-actions .linkish{font-size:14px;color:var(--green);background:transparent;border:0;padding:0;min-height:30px;font-weight:700}
.list-find{margin-left:34px;gap:12px}
.list-find .primary{min-height:36px;padding:6px 14px}
.list-find small{color:var(--muted)}
.list-footer{border-top:1px solid var(--line);padding-top:14px;margin-top:8px;display:flex;flex-direction:column;gap:10px;align-items:flex-start}
.list-footer p{margin:0;color:var(--ink)}
.list-banner{display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--accent-wash);color:var(--ink);border-radius:14px;padding:10px 14px;margin:0 0 12px}
.list-banner .linkish{color:var(--green);font-weight:750;background:transparent;border:0}
.compare-card-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-top:8px}
.compare-card-actions .list-add-button,.compare-card-actions .list-choose{min-height:36px;padding:6px 14px}
.list-on{color:var(--green-dark);font-weight:750;font-size:14px}
@media(max-width:420px){.list-choice,.list-find{margin-left:0}}

/* Checkout: clip before the store card is scanned */
.clip-first{display:flex;flex-direction:column;gap:2px;margin-top:10px;padding:10px 12px;border-radius:12px;background:var(--warn-wash);color:var(--warn);font-size:14px}
.clip-first strong{color:var(--ink);font-size:14.5px}
.clip-first .linkish{align-self:flex-start;margin-top:4px;padding:0;border:0;background:transparent;color:var(--green);font-weight:750;min-height:30px}
.store-card-full .clip-first-full{color:#7a4c00;background:#fdecc8;border-radius:10px;padding:8px 12px;max-width:340px;font-size:15px}

/* ---- Pull to refresh ---- */
.ptr{position:fixed;top:64px;left:50%;z-index:25;width:38px;height:38px;border-radius:50%;background:var(--surface-2);box-shadow:0 4px 14px var(--shade);display:grid;place-items:center;opacity:0;transform:translate(-50%,0);transition:opacity .15s;pointer-events:none}
.ptr svg{width:20px;height:20px;fill:none;stroke:var(--muted);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.ptr.visible{opacity:1}
.ptr.ready svg{stroke:var(--green)}
