* { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f5f5f5; color: #333; }
  .header { background: #1a472a; color: #fff; padding: 20px 0; text-align: center; }
  .header h1 { font-size: 1.6em; font-weight: 600; }
  .header h1 .flag { font-size: 1.2em; margin-right: 8px; vertical-align: middle; }
  .header .subtitle { font-size: 0.85em; opacity: 0.8; margin-top: 4px; }
  .tabs {
    max-width: 900px; margin: 0 auto; display: flex; gap: 4px;
    padding: 0 16px; border-bottom: 2px solid #ddd;
    justify-content: center;
  }
  .tab {
    background: transparent; border: none; padding: 14px 20px;
    font-size: 1em; cursor: pointer; color: #666; font-weight: 600;
    border-bottom: 3px solid transparent; margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
  }
  .tab:hover { color: #1a472a; }
  .tab.active { color: #1a472a; border-bottom-color: #1a472a; }
  .tab-panel { display: none; }
  .tab-panel.active { display: block; }
  .basket-picker {
    max-width: 700px; margin: 24px auto; padding: 0 16px;
    display: flex; gap: 10px; align-items: center;
  }
  .basket-picker label { font-weight: 600; }
  .basket-picker select {
    flex: 1; padding: 10px; font-size: 1em;
    border: 1px solid #ccc; border-radius: 6px;
  }
  .primary-btn {
    background: #1a472a; color: #fff; border: none;
    padding: 10px 22px; font-size: 1em; font-weight: 600;
    border-radius: 6px; cursor: pointer; transition: background 0.15s;
  }
  .primary-btn:hover { background: #2a5a3c; }
  .primary-btn-large {
    padding: 14px 28px; font-size: 1.05em; font-weight: 700;
    box-shadow: 0 2px 6px rgba(26,71,42,0.25);
  }
  .primary-btn-large:hover { background: #2a5a3c; box-shadow: 0 3px 10px rgba(26,71,42,0.35); }
  .secondary-btn {
    background: #fff; color: #1a472a; border: 1px solid #1a472a;
    padding: 8px 16px; font-size: 0.9em; font-weight: 500;
    border-radius: 6px; cursor: pointer; transition: background 0.15s;
  }
  .secondary-btn:hover { background: #f0f0f0; }
  .receipt-row {
    display: grid; grid-template-columns: 32px 1fr 70px 70px 36px; gap: 10px; align-items: stretch;
    margin-bottom: 8px; position: relative;
  }
  .receipt-row .row-num {
    color: #888; font-size: 0.95em; padding-top: 9px; text-align: right;
  }
  .receipt-row input.row-input {
    padding: 8px 10px; font-size: 1em; border: 1px solid #ccc; border-radius: 4px;
    width: 100%;
  }
  .receipt-row input.row-input.locked {
    background: #e8f5e9; border-color: #4caf50; color: #1a472a; font-weight: 600;
  }
  .receipt-row .row-price {
    padding: 8px 6px; font-size: 0.92em; border: 1px solid #e0e0e0; border-radius: 4px;
    background: #fafafa; color: #333; text-align: right; line-height: 1.25;
    display: flex; flex-direction: column; justify-content: center;
  }
  .receipt-row .row-price .label {
    font-size: 0.7em; color: #888; text-transform: uppercase; letter-spacing: 0.04em;
  }
  .receipt-row .row-price.row-latest { background: #f2f8f3; border-color: #cfe4d4; color: #1a472a; }
  .receipt-row .row-price.row-latest.unmatched { background: #fafafa; border-color: #e0e0e0; color: #aaa; }
  .receipt-row .row-price.cheaper-now  { background: #e8f5e9; border-color: #4caf50; color: #1a472a; font-weight: 700; }
  .receipt-row .row-price.pricier-now  { background: #fdecea; border-color: #f5c2c0; color: #8a2b25; }
  .receipt-row .row-remove {
    background: #fff; color: #d4351c; border: 1px solid #ddd; border-radius: 4px;
    cursor: pointer; font-size: 1.2em; line-height: 1;
  }
  .receipt-row .row-remove:hover { background: #fee; border-color: #d4351c; }
  .receipt-row .row-suggestions {
    position: absolute; top: 100%; left: 42px; right: 194px; background: #fff;
    border: 1px solid #999; border-top: none; max-height: 320px; overflow-y: auto;
    z-index: 10; box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  }
  .receipt-row .row-suggestion {
    padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #eee;
    font-size: 0.95em; line-height: 1.3;
  }
  .receipt-row .row-suggestion:hover { background: #f0f8f0; }
  .receipt-row .row-suggestion .sug-name { display: block; }
  .receipt-row .row-suggestion .sug-meta {
    color: #666; font-size: 0.85em; display: block; margin-top: 2px;
  }
  .photo-thumb {
    position: relative; width: 110px; height: 140px; border: 1px solid #ccc;
    border-radius: 4px; overflow: hidden; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .photo-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
  }
  .photo-thumb .photo-status {
    position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,0.7);
    color: #fff; font-size: 0.75em; padding: 2px 6px; border-radius: 3px;
    line-height: 1.2;
  }
  .photo-thumb .photo-status.done    { background: rgba(46,125,50,0.85); }
  .photo-thumb .photo-status.failed  { background: rgba(212,53,28,0.85); }
  .photo-thumb .photo-status.running { background: rgba(33,150,243,0.85); }
  .photo-thumb .photo-remove {
    position: absolute; top: 4px; right: 4px;
    background: rgba(255,255,255,0.92); color: #d4351c; border: 1px solid #d4351c;
    border-radius: 50%; width: 22px; height: 22px; padding: 0; line-height: 1;
    font-size: 14px; font-weight: 700; cursor: pointer;
  }
  .photo-thumb .photo-remove:hover { background: #fee; }
  .basket-results { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; }
  .basket-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px; margin-bottom: 24px;
  }
  .basket-super {
    background: #fff; border-radius: 8px; padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex; flex-direction: column; gap: 8px;
  }
  .basket-super.cheapest { background: #e8f5e9; border: 2px solid #4caf50; }
  .split-card {
    background: linear-gradient(135deg, #fff7e6 0%, #ffe0b2 100%);
    border: 2px solid #ff9800; border-radius: 8px;
    padding: 20px; margin-bottom: 24px;
  }
  .split-card h3 { margin-bottom: 12px; color: #e65100; }
  .split-card .total {
    font-size: 2.4em; font-weight: 700; color: #e65100;
  }
  .split-card .subtotal { font-size: 1em; color: #666; margin: 4px 0; }
  .split-card .shop-breakdown {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
  }
  .split-card .shop-breakdown .chip {
    background: rgba(255,255,255,0.7); padding: 6px 12px; border-radius: 16px;
    font-size: 0.9em; display: flex; align-items: center; gap: 6px;
  }
  .basket-super .super-head { display: flex; justify-content: space-between; align-items: center; }
  .basket-super .total {
    font-size: 2.2em; font-weight: 700; color: #1a472a;
  }
  .basket-super .breakdown {
    font-size: 1em; color: #555; line-height: 1.5;
  }
  .basket-super .match-rate {
    font-size: 0.95em; color: #777;
  }
  .basket-super .match-rate.low { color: #d4351c; font-weight: 600; }
  .basket-super .loyalty-row {
    margin-top: 6px; font-size: 1em; color: #2a7a2a; line-height: 1.5;
  }
  .basket-super .loyalty-row strong { color: #1a472a; font-size: 1.1em; }
  .basket-super .loyalty-savings {
    color: #d4351c; font-weight: 600; font-size: 0.92em;
  }
  .basket-items table {
    width: 100%; border-collapse: separate; border-spacing: 0; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-size: 1em;
  }
  .basket-items th, .basket-items td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee;
  }
  .basket-items th {
    background: #f5f5f5; font-weight: 600;
    position: sticky; top: 0; z-index: 10;
    box-shadow: 0 2px 3px rgba(0,0,0,0.06);
  }
  .basket-items td.price { text-align: right; font-family: monospace; }
  .basket-items td.cheapest { background: #e8f5e9; font-weight: 700; }
  .basket-items td.missing { color: #ccc; text-align: center; }
  .basket-items td.imputed { color: #888; font-style: italic; background: #fafafa; }
  .basket-items td.shop-cell { vertical-align: top; min-width: 180px; }
  .basket-items td.shop-cell.cheapest { background: #e8f5e9; }
  .basket-items .shop-cell-price { font-size: 1.05em; font-weight: 700; color: #1a472a; font-family: monospace; }
  .basket-items td.cheapest .shop-cell-price { color: #2e7d32; }
  .basket-items .shop-cell-name { font-size: 0.8em; color: #666; line-height: 1.2; margin-top: 2px; }
  .basket-items td.cheapest .shop-cell-name { color: #555; }
  .basket-items tr:hover { background: #fafafa; }
  .search-bar { max-width: 700px; margin: 24px auto 0; padding: 0 16px; position: relative; }
  .search-bar input {
    width: 100%; padding: 14px 18px; font-size: 1.1em; border: 2px solid #ccc;
    border-radius: 8px; outline: none; transition: border-color 0.2s;
  }
  .search-bar input:focus { border-color: #1a472a; }
  .suggestions {
    position: absolute; top: 100%; left: 16px; right: 16px;
    background: #fff; border: 1px solid #ccc; border-top: none;
    border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 320px; overflow-y: auto; z-index: 10; display: none;
  }
  .suggestions.open { display: block; }
  .suggestion-item {
    padding: 10px 18px; cursor: pointer; font-size: 0.95em;
    border-bottom: 1px solid #eee;
  }
  .suggestion-item:last-child { border-bottom: none; }
  .suggestion-item:hover, .suggestion-item.active { background: #f0f7f2; }
  .suggestion-item mark { background: #fff3a3; padding: 0 1px; }
  .filters {
    max-width: 900px; margin: 14px auto 0; padding: 0 16px;
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  }
  .filters label {
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    padding: 4px 6px; border-radius: 4px; transition: opacity 0.15s;
    opacity: 0.45;
  }
  .filters label:has(input:checked) { opacity: 1; }
  .filters input[type="checkbox"] { cursor: pointer; }
  .filters .supermarket {
    display: inline-block; padding: 4px 10px; border-radius: 4px;
    font-weight: 700; color: #fff; font-size: 1.1em;
    letter-spacing: 0.03em; text-transform: uppercase;
  }
  .sort-bar {
    max-width: 700px; margin: 12px auto 0; padding: 0 16px;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    font-size: 1.05em; color: #333;
  }
  .sort-bar label { font-weight: 600; }
  .sort-bar select {
    padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px;
    font-size: 1em; cursor: pointer; background: #fff;
  }
  .stats { text-align: center; padding: 12px 16px; font-size: 0.85em; color: #777; }
  .results { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }
  .result-count { padding: 8px 0; font-size: 0.9em; color: #666; }
  .product-card {
    background: #fff; border-radius: 8px; padding: 14px 18px; margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); display: flex; justify-content: space-between;
    align-items: center; gap: 12px;
  }
  .product-info { flex: 1; min-width: 0; }
  .product-name { font-weight: 600; font-size: 0.95em; }
  .product-name a { color: inherit; text-decoration: none; }
  .product-name a:hover { text-decoration: underline; color: #1a472a; }
  .product-meta { font-size: 0.9em; color: #666; margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; }
  .product-meta .supermarket {
    display: inline-block; padding: 4px 10px; border-radius: 4px;
    font-weight: 700; color: #fff; font-size: 1.1em; margin-right: 8px;
    letter-spacing: 0.03em; text-transform: uppercase;
  }
  .s-tesco { background: #00539f; }
  .s-sainsburys { background: #f06c00; }
  .s-waitrose { background: #5d8a3c; }
  .s-asda { background: #78b93f; }
  .s-iceland { background: #e31837; }
  .s-coop { background: #00b1e7; }
  .s-lidl { background: #0050aa; }
  .s-aldi { background: #002f6c; }
  .s-morrisons { background: #c9a600; }
  .s-ocado { background: #6a2d85; }
  .product-prices { text-align: right; white-space: nowrap; }
  .price-main { font-size: 1.2em; font-weight: 700; color: #1a472a; }
  .price-club { font-size: 0.95em; font-weight: 600; color: #d4351c; }
  .price-unit { font-size: 0.9em; color: #666; margin-top: 2px; }
  .price-unit strong { color: #1a472a; font-size: 1.05em; }
  .price-offer { font-size: 0.75em; color: #d4351c; font-weight: 500; }
  .empty { text-align: center; padding: 40px; color: #999; font-size: 1.1em; }
  .group-card {
    background: #fff; border-radius: 8px; padding: 14px 18px; margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .group-header {
    font-weight: 600; font-size: 1em; padding-bottom: 8px; border-bottom: 1px solid #eee;
    margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center;
  }
  .group-spread {
    font-size: 0.85em; color: #d4351c; font-weight: 700;
  }
  .group-offerings {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
  }
  .offering {
    padding: 8px 10px; background: #f9f9f9; border-radius: 5px;
    display: flex; flex-direction: column; gap: 3px;
  }
  .offering a { text-decoration: none; color: inherit; display: block; }
  .offering a:hover { text-decoration: underline; }
  .offering .supermarket { font-size: 0.85em; padding: 2px 6px; }
  .offering .price-row { display: flex; justify-content: space-between; align-items: baseline; }
  .offering .price-main { font-size: 1.1em; font-weight: 700; color: #1a472a; }
  .offering .price-per-kg { font-size: 0.8em; color: #666; }
  .offering.cheapest { background: #e8f5e9; border: 1px solid #4caf50; }
