/* Supermarket receipts page (2026-10-13). Hebrew, right-to-left, phone first; built on style.css's
   cards, segmented control, bottom sheets and theme variables. Chart series colours are the
   dataviz reference categorical palette (fixed order; dark steps on the dark themes). */
.gr-page { --gr-ok: var(--green); --gr-warn: var(--yellow); --gr-bad: var(--red); }
.gr-page, .gr-modal, #gr-drill .modal { direction: rtl; text-align: right; }

.gr-banner {
  background: rgba(255, 159, 10, 0.12); color: var(--text); border: 1px solid rgba(255, 159, 10, 0.35);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px;
}

/* Upload */
.gr-upload { padding: 12px; }
.gr-upload-main {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 14px;
  border: 2px dashed var(--border); border-radius: 14px; background: transparent; color: var(--text);
  font: inherit; text-align: right; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gr-upload-main:active, .gr-upload.drag .gr-upload-main { border-color: var(--primary); background: rgba(255, 159, 10, 0.06); }
.gr-upload-icon { font-size: 34px; line-height: 1; flex-shrink: 0; }
.gr-upload-title { display: block; font-size: 17px; font-weight: 700; }
.gr-upload-sub { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.gr-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-dim); }
.gr-check input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }
.gr-upload-status { font-size: 13px; margin-top: 8px; color: var(--text-dim); }
.gr-upload-status:empty { display: none; }
.gr-upload-status .bad { color: var(--red); }
.gr-upload-status .ok { color: var(--green); }
.gr-upload-status [data-open] { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

/* Rows (pending, stores, items, receipts) */
.gr-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gr-row:last-child { border-bottom: none; }
.gr-row.static { cursor: default; }
.gr-row .gr-ico { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }
.gr-row .gr-main { flex: 1; min-width: 0; }
.gr-row .gr-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-row .gr-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.gr-row .gr-amt { font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; direction: ltr; }
.gr-row .gr-amt small { display: block; font-size: 11px; color: var(--text-dim); font-weight: 500; text-align: left; }
.gr-row .gr-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.gr-empty { color: var(--text-dim); font-size: 14px; padding: 14px 2px; text-align: center; }
.gr-meta { font-size: 12px; color: var(--text-dim); margin: 2px 0 10px; }
.gr-row .gr-meta { margin: 2px 0 0; }

.gr-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600; background: var(--bg-input); color: var(--text-dim); white-space: nowrap;
}
.gr-chip.ok { background: rgba(48, 209, 88, 0.14); color: var(--green); }
.gr-chip.warn { background: rgba(255, 214, 10, 0.16); color: var(--text); }
.gr-chip.bad { background: rgba(255, 69, 58, 0.14); color: var(--red); }
.gr-chip.link { background: rgba(10, 132, 255, 0.13); color: var(--blue); }
.gr-spin { display: inline-block; animation: grSpin 1.1s linear infinite; }
@keyframes grSpin { to { transform: rotate(360deg); } }

/* Period */
.gr-period { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.gr-period-label { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.gr-span { margin-bottom: 14px; }

/* Summary tiles */
.gr-summary .card { padding: 12px; margin-bottom: 0; }
.gr-tile-label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.gr-tile-value { font-size: 22px; font-weight: 800; margin-top: 2px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.gr-tile-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.gr-up { color: var(--red); }
.gr-down { color: var(--green); }

/* Countries side by side */
.gr-countries { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gr-country { background: var(--bg-input); border-radius: 14px; padding: 12px; min-width: 0; }
.gr-country-head { font-size: 14px; font-weight: 700; }
.gr-country-total { font-size: 20px; font-weight: 800; margin-top: 4px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.gr-country-line { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* Category share bars (magnitude: one hue) */
.gr-cat { display: block; width: 100%; padding: 9px 2px; border: none; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: right; cursor: pointer; }
.gr-cat:last-child { border-bottom: none; }
.gr-cat-top { display: flex; align-items: baseline; gap: 8px; }
.gr-cat-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-cat-amt { font-size: 14px; font-weight: 700; direction: ltr; font-variant-numeric: tabular-nums; }
.gr-cat-bar { height: 6px; border-radius: 3px; background: var(--bg-input); margin-top: 6px; overflow: hidden; }
.gr-cat-bar span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.gr-cat-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-dim); margin-top: 4px; flex-wrap: wrap; }
.gr-note { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.gr-note:empty { display: none; }
.gr-chart { height: 260px; }

/* Review sheet */
.gr-modal { max-width: 640px; }
.gr-files { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.gr-files a { font-size: 13px; padding: 6px 10px; border-radius: 10px; background: var(--bg-input); color: var(--text); }
.gr-alert { border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.gr-alert.bad { background: rgba(255, 69, 58, 0.12); color: var(--text); border: 1px solid rgba(255, 69, 58, 0.3); }
.gr-alert.warn { background: rgba(255, 214, 10, 0.14); color: var(--text); border: 1px solid rgba(255, 214, 10, 0.35); }
.gr-alert.ok { background: rgba(48, 209, 88, 0.12); color: var(--text); border: 1px solid rgba(48, 209, 88, 0.3); }
.gr-alert .gr-check { color: var(--text); margin-top: 8px; }
.gr-form .form-row { gap: 10px; }
.gr-form .form-group { margin-bottom: 10px; }
.gr-form input[type="date"] { direction: ltr; text-align: right; }
.gr-items { margin: 6px 0 10px; }
.gr-item { border: 1px solid var(--border); border-radius: 14px; padding: 8px; margin-bottom: 8px; background: var(--bg); }
.gr-item.mem { border-color: rgba(10, 132, 255, 0.45); }
.gr-item-l1, .gr-item-l2 { display: flex; gap: 6px; align-items: center; }
.gr-item-l2 { margin-top: 6px; }
.gr-item input, .gr-item select {
  min-width: 0; padding: 8px 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input);
  color: var(--text); font-size: 16px; min-height: 40px;
}
.gr-item .i-name { flex: 1; }
.gr-item .i-total { width: 96px; direction: ltr; text-align: left; font-weight: 700; }
.gr-item .i-qty { width: 64px; direction: ltr; text-align: left; }
.gr-item .i-cat { flex: 1; }
.gr-item .i-del { background: none; border: none; color: var(--text-dim); font-size: 20px; min-width: 40px; min-height: 40px; cursor: pointer; }
/* ± — the iPhone's decimal keypad has no minus key; a discount or a return is a negative line */
.gr-item .i-sign { flex: none; min-width: 40px; min-height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.gr-item.neg .i-sign { color: var(--green); border-color: var(--green); }
.gr-item-orig { font-size: 11px; color: var(--text-dim); margin-top: 4px; direction: auto; unicode-bidi: plaintext; }
.gr-item.neg .i-total { color: var(--green); }
.gr-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.gr-sum-box { background: var(--bg-input); border-radius: 13px; padding: 9px 12px; min-height: 46px; }
.gr-sum-box .lbl { font-size: 12px; color: var(--text-dim); }
.gr-sum-box .val { font-size: 17px; font-weight: 800; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.gr-buttons { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.gr-buttons .btn-primary { flex: 1; }
.gr-link { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.gr-sub { font-size: 13px; font-weight: 700; color: var(--text-dim); margin: 6px 0 6px; }

/* Settings */
.gr-settings summary { cursor: pointer; font-size: 14px; font-weight: 700; padding: 2px 0; }
.gr-settings-body { margin-top: 10px; }
.gr-cat-line { display: flex; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.gr-cat-line input[type="text"], .gr-cat-add input {
  min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input);
  color: var(--text); font-size: 16px; min-height: 38px;
}
.gr-cat-line .c-icon, .gr-cat-add #gr-cat-icon { width: 52px; text-align: center; }
.gr-cat-line .c-name, .gr-cat-add #gr-cat-name { flex: 1; }
.gr-cat-line label { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.gr-cat-line.off .c-name { opacity: 0.5; }
.gr-cat-add { display: flex; gap: 6px; margin: 10px 0 14px; }

/* Split cost (2026-10-15): who a line was bought for — mine (me + partner), shared (the household,
   she owes her %), roommate (all hers). Shared is blue, hers the primary orange; mine is neutral. */
.gr-chip.bot { background: rgba(191, 90, 242, 0.14); color: var(--purple, #BF5AF2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gr-chip.s-shared { background: rgba(10, 132, 255, 0.13); color: var(--blue); }
.gr-chip.s-roommate { background: rgba(255, 159, 10, 0.16); color: var(--text); }
.gr-origin { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.gr-view { margin: -4px 0 14px; }
.gr-view[hidden] { display: none; }

/* Review sheet: the receipt's "למי?" and each line's three-way toggle */
.gr-split-row select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input);
  color: var(--text); font-size: 16px; min-height: 42px;
}
.gr-split-row .gr-note { margin-top: 4px; }
.gr-item-l3 { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-width: 0; }
.gr-item .i-split { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--bg-input); border: 1px solid var(--border); min-width: 0; }
.gr-item .i-split button {
  border: none; background: transparent; color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 9px; min-height: 34px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 112px; -webkit-tap-highlight-color: transparent;
}
.gr-item .i-split button.active { background: var(--bg-card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.gr-item .i-split button.active[data-s="shared"] { color: var(--blue); }
.gr-item .i-split button.active[data-s="roommate"] { color: var(--primary); }
/* Following the receipt default (or its product): shown, but quieter than a line set by hand */
.gr-item .i-split.follow button.active { box-shadow: none; opacity: 0.75; }
.gr-item .i-her { margin-inline-start: auto; font-size: 12px; color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gr-her { margin-top: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 159, 10, 0.1); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gr-her.zero { background: var(--bg-input); color: var(--text-dim); font-weight: 600; }
.gr-her:empty { display: none; }

/* The roommate card: per-month what she owes, expand a month for its lines */
.gr-rm-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 2px 0 8px; font-size: 13px; color: var(--text-dim); }
.gr-rm-total:empty { display: none; }
.gr-rm-total b { font-size: 22px; font-weight: 800; color: var(--text); direction: ltr; font-variant-numeric: tabular-nums; }
.gr-rm-month { border-bottom: 1px solid var(--border); }
.gr-rm-month:last-child { border-bottom: none; }
.gr-rm-month > summary, .gr-rm-month.zero {
  display: flex; align-items: center; gap: 10px; padding: 11px 2px; list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gr-rm-month > summary::-webkit-details-marker { display: none; }
.gr-rm-month > summary::before { content: "‹"; color: var(--text-dim); font-size: 16px; transition: transform 0.15s; }
.gr-rm-month[open] > summary::before { transform: rotate(-90deg); }
.gr-rm-month.zero { cursor: default; color: var(--text-dim); }
.gr-rm-m { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.gr-rm-n { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.gr-rm-month .gr-amt { font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; direction: ltr; text-align: left; }
.gr-rm-month .gr-amt small { display: block; font-size: 11px; color: var(--text-dim); font-weight: 500; }
.gr-rm-body { padding: 0 2px 12px; }
.gr-rm-rc { margin-bottom: 10px; }
.gr-rm-rc-head { font-size: 13px; font-weight: 700; color: var(--text-dim); padding: 4px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-rm-line { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }
.gr-rm-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-rm-line .gr-amt { font-size: 14px; }
.gr-rm-copybox { margin: 10px 0; }
.gr-rm-copybox[hidden] { display: none; }
.gr-rm-copybox textarea {
  width: 100%; margin: 6px 0; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input);
  color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; resize: vertical; unicode-bidi: plaintext;
}
.gr-rm-settings { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.gr-rm-settings summary { cursor: pointer; font-size: 14px; font-weight: 700; padding: 2px 0; }
.gr-rm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; align-items: end; }
.gr-rm-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); font-weight: 600; min-width: 0; }
.gr-rm-field input, .gr-rm-field select {
  min-width: 0; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input);
  color: var(--text); font-size: 16px; min-height: 42px; font-weight: 500;
}
.gr-rm-form .gr-note { grid-column: 1 / -1; margin-top: 0; }
.gr-rm-form button[type="submit"] { grid-column: 1 / -1; }

/* Prices and comparisons (2026-10-23): price changes, where it is cheaper, store price levels,
   Israel against Berlin, the product sheet. ▲ red = dearer, ▼ green = cheaper, as elsewhere here. */
.gr-chart-sm { height: 220px; }
.gr-chart-xs { height: 150px; }
.gr-mix { height: 300px; }
.gr-mix[hidden] { display: none; }
.gr-search {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input);
  color: var(--text); font-size: 16px; min-height: 42px; margin: 4px 0 6px;
}
.gr-more { margin-top: 8px; }
.gr-row .gr-amt small .gr-up, .gr-row .gr-amt small .gr-down { font-weight: 700; }
.gr-table { margin-top: 8px; }
.gr-table summary { cursor: pointer; font-size: 13px; color: var(--text-dim); padding: 2px 0; }
.gr-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.gr-tbl th, .gr-tbl td { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: right; }
.gr-tbl th { color: var(--text-dim); font-weight: 600; }
.gr-tbl .n { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Store price levels: a bar from the middle — rightwards when cheaper, leftwards when dearer */
.gr-level-head { font-size: 13px; font-weight: 700; margin: 10px 0 2px; }
.gr-level { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.gr-level:last-child { border-bottom: none; }
.gr-level-name { min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-level-name small { display: block; font-size: 11px; color: var(--text-dim); font-weight: 500; }
.gr-level-track { position: relative; height: 8px; border-radius: 4px; background: var(--bg-input); }
.gr-level-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--text-dim); opacity: 0.6; }
.gr-level-track span { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.gr-level-track .cheap { background: var(--green); }
.gr-level-track .dear { background: var(--red); }
.gr-level-val { font-size: 12px; white-space: nowrap; text-align: left; }
.gr-cmp-head { font-size: 15px; margin: 2px 0 6px; }
.gr-cmp-head .gr-meta { display: block; margin: 2px 0 0; }

/* The product sheet */
.gr-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }
.gr-prod-edit { display: grid; gap: 8px; margin: 8px 0 12px; padding: 10px; border-radius: 14px; background: var(--bg-input); }
.gr-prod-edit .gr-rm-field select, .gr-prod-edit .gr-rm-field input { background: var(--bg-card); }
.gr-prod-rename { display: flex; gap: 8px; align-items: flex-end; }
.gr-prod-rename .gr-rm-field { flex: 1; }
.gr-prod-rename .btn { min-height: 42px; }
.gr-prod-edit .gr-note { margin-top: 0; }
.gr-cons { font-size: 14px; margin: 4px 0 2px; }
.gr-pd-country { margin: 4px 0 2px; }

/* The category drill-down: open a product, or move it to another category */
.gr-drill-row { flex-wrap: wrap; }
.gr-drill-row [data-product] { cursor: pointer; }
.gr-chev { color: var(--text-dim); font-weight: 400; }
.gr-drill-row .d-cat {
  flex-basis: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-input); color: var(--text); font-size: 15px; min-height: 38px; margin-top: 2px;
}

@media (min-width: 900px) {
  .gr-page { max-width: 980px; }
  .gr-summary { grid-template-columns: repeat(4, 1fr); }
}

/* Wolt (2026-11-07): orders and what she owes of each — the roommate card's month rows, reused */
.gr-wolt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gr-wolt-head .card-title { margin-bottom: 0; }
.gr-wolt-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 12px; padding: 12px; border-radius: 14px; background: var(--bg-input); align-items: end; }
.gr-wolt-form[hidden], .gr-wolt-form [hidden] { display: none; }
.gr-wolt-form .gr-sub { grid-column: 1 / -1; margin: 0; }
.gr-wolt-form .gr-rm-field input, .gr-wolt-form .gr-rm-field select { background: var(--bg-card); }
.gr-wolt-wide { grid-column: 1 / -1; }
.gr-wolt-form .gr-her { margin-top: 0; }
.gr-wolt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gr-wolt-actions .btn { min-height: 40px; }
.gr-wolt-actions .btn-danger { margin-inline-start: auto; }
.gr-wolt .gr-rm-total { margin-top: 8px; }
.gr-rm-line[data-wolt] { cursor: pointer; }

/* Wolt from a receipt (2026-11-07): the upload button, the invoices being read, the lines to tick */
.gr-pick-wolt { margin-top: 8px; }
.gr-wolt-btns { display: flex; gap: 6px; }
.gr-wolt .gr-upload-status:empty { display: none; }
.gr-wolt-items { display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--bg-card); }
.gr-wolt-items[hidden] { display: none; }
.gr-wolt-items .gr-sub { margin: 0 0 4px; }
.gr-wolt-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.gr-wolt-item input { width: 18px; height: 18px; flex-shrink: 0; }
.gr-wolt-item .gr-rm-nm { flex: 1; }
.gr-wolt-item .gr-amt { font-variant-numeric: tabular-nums; direction: ltr; white-space: nowrap; }
.gr-wolt-item.neg { color: var(--green); }
.gr-wolt-items .gr-note { margin-top: 4px; }

/* A line of several units: how many were hers (2026-11-07) */
.gr-wolt-item select { flex-shrink: 0; min-width: 52px; min-height: 34px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); color: var(--text); font-size: 16px; }
.gr-wolt-item small { color: var(--text-dim); font-size: 11px; }
