/* ═══════════════════════════════════════════════════════════════════
   Abu Yaser Garage — stock book for scrapped truck engines and gearboxes.

   Built for one man holding one phone in a hot yard in Misfah. Every
   decision below answers to that: galvanised greys that stay readable in
   direct sun, amber and teal doing the work of telling an engine from a
   gearbox at a glance, and the price set larger than anything else on the
   row, because the price is what he says out loud to the customer.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Workshop steel */
  --ink:          #131a1f;
  --ink-soft:     #1e2830;
  --steel-1:      #5a6b78;
  --steel-2:      #7d8d99;
  --hair:         #ccd5da;
  --hair-soft:    #e0e6e9;
  --plate:        #e7ecee;
  --surface:      #ffffff;

  /* Category coding: an engine runs hot, a gearbox runs cold */
  --engine:       #c07000;
  --engine-ink:   #8a5000;
  --engine-soft:  #fdf1dc;
  --gearbox:      #0e6b75;
  --gearbox-ink:  #0a4c54;
  --gearbox-soft: #dff0f2;

  /* States */
  --sold:         #8e241d;
  --sold-soft:    #f8e7e5;
  --ok:           #1b6b3c;
  --ok-soft:      #e3f2e8;

  --focus:        #0e6b75;

  --t-xs:   0.78rem;
  --t-sm:   0.86rem;
  --t-base: 1rem;
  --t-md:   1.08rem;
  --t-lg:   1.32rem;
  --t-xl:   1.62rem;
  --t-2xl:  2rem;

  --gut: 1rem;
  --bar-h: 3.25rem;
  --radius: 4px;
  --radius-lg: 10px;

  --shadow-bar: 0 1px 0 rgba(19, 26, 31, 0.1);
  --shadow-lift: 0 -6px 18px rgba(19, 26, 31, 0.1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--plate);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  font-size: var(--t-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, p, legend, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { width: 1.25em; height: 1.25em; display: block; }
[hidden] { display: none !important; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Numerals line up down a column so two prices can be compared by eye. */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* ───────────────────────────────────────────────────────────── boot ── */

.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--engine);
}
.boot__mark { width: 3rem; height: 3rem; animation: turn 2.4s linear infinite; }

@keyframes turn { to { transform: rotate(-360deg); } }

@media (prefers-reduced-motion: reduce) {
  .boot__mark { animation: none; }
}

/* ─────────────────────────────────────────────────────────── sign in ── */

.signin {
  min-height: 100svh;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2rem;
  padding: 2rem var(--gut) calc(2rem + env(safe-area-inset-bottom));
}

.signin__plate { text-align: center; color: var(--surface); }
.signin__mark { width: 3.4rem; height: 3.4rem; margin: 0 auto 1rem; color: var(--engine); }

.signin__name {
  font-size: var(--t-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.signin__trade { font-size: var(--t-md); color: #a9b7c0; margin-top: 0.15rem; }

.signin__rule {
  width: 2.75rem; height: 3px;
  margin: 1rem auto;
  border: 0; border-radius: 2px;
  background: var(--engine);
}

.signin__place { font-size: var(--t-sm); color: #7d8d99; }

.signin__form {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.4rem var(--gut) 1.5rem;
  display: grid;
  gap: 1rem;
}

/* ──────────────────────────────────────────────────────────── fields ── */

.field { display: grid; gap: 0.4rem; border: 0; padding: 0; margin: 0; min-width: 0; }

.field__label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
  padding: 0;
}

.field__opt { font-weight: 400; color: var(--steel-2); }
.field__hint { font-size: var(--t-xs); color: var(--steel-1); }

.field__input {
  width: 100%;
  min-height: 3rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: var(--t-md);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--hair);
  border-radius: var(--radius);
  appearance: none;
}
.field__input::placeholder { color: var(--steel-2); }
.field__input:focus { border-color: var(--focus); }
.field__input--area { min-height: 5.5rem; resize: vertical; line-height: 1.6; }

select.field__input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235a6b78' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.9rem center;
  background-size: 12px 8px;
  padding-left: 2.4rem;
}

/* A price range is two legs of one thought, joined by a dash. */
.range { display: flex; align-items: flex-end; gap: 0.5rem; }
.range__leg { flex: 1 1 0; display: grid; gap: 0.25rem; min-width: 0; }
.range__tag { font-size: var(--t-xs); color: var(--steel-1); }
.range__input { text-align: center; font-variant-numeric: tabular-nums; }
.range__dash {
  flex: 0 0 auto;
  width: 0.9rem; height: 2px;
  margin-bottom: 1.45rem;
  background: var(--hair);
}

.stepper {
  display: flex; align-items: stretch;
  border: 1.5px solid var(--hair);
  border-radius: var(--radius);
  overflow: hidden;
  width: max-content;
}
.stepper__btn {
  width: 3.25rem; min-height: 3rem;
  border: 0; background: var(--plate);
  color: var(--ink); font: inherit; font-size: var(--t-lg);
  cursor: pointer;
}
.stepper__btn:active { background: var(--hair); }
.stepper__value {
  width: 4rem; border: 0; text-align: center;
  font: inherit; font-size: var(--t-md); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface);
}

/* Two big targets — the first decision on every new record. */
.pick { border: 0; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.pick__options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.pick__opt {
  position: relative;
  display: grid; justify-items: center; gap: 0.35rem;
  padding: 0.9rem 0.5rem;
  border: 1.5px solid var(--hair);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--t-md); font-weight: 600;
  cursor: pointer;
}
.pick__opt svg { width: 1.8rem; height: 1.8rem; color: var(--steel-1); }
.pick__opt input { position: absolute; opacity: 0; pointer-events: none; }

.pick__opt--engine:has(input:checked) {
  border-color: var(--engine); background: var(--engine-soft); color: var(--engine-ink);
  box-shadow: inset 0 0 0 1px var(--engine);
}
.pick__opt--gearbox:has(input:checked) {
  border-color: var(--gearbox); background: var(--gearbox-soft); color: var(--gearbox-ink);
  box-shadow: inset 0 0 0 1px var(--gearbox);
}
.pick__opt--engine:has(input:checked) svg { color: var(--engine); }
.pick__opt--gearbox:has(input:checked) svg { color: var(--gearbox); }
.pick__opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ─────────────────────────────────────────────────────────── buttons ── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 2.85rem;
  padding: 0.5rem 0.95rem;
  font: inherit; font-size: var(--t-base); font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: transparent; color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 1.15em; height: 1.15em; }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn--primary { background: var(--ink); color: var(--surface); }
.btn--primary:active:not(:disabled) { background: var(--ink-soft); }

.btn--outline { border-color: var(--hair); background: var(--surface); }
.btn--outline:active { background: var(--plate); }

.btn--quiet { color: var(--ink); padding-inline: 0.55rem; }
.btn--quiet:active { background: var(--hair-soft); }

.btn--danger { background: var(--sold); color: var(--surface); }
.btn--danger-quiet { color: var(--sold); }

.btn--block { width: 100%; }
.btn--tall { min-height: 3.4rem; font-size: var(--t-md); }

.iconbtn {
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink);
  cursor: pointer; flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.iconbtn svg { width: 1.5rem; height: 1.5rem; }
.iconbtn--onink { color: #b9c5cc; }
.iconbtn:active { background: rgba(125, 141, 153, 0.18); }

.dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--engine); flex: 0 0 auto;
}

/* ──────────────────────────────────────────────────────────── topbar ── */

.stock { padding-bottom: 7rem; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink);
  padding: calc(env(safe-area-inset-top) + 0.35rem) var(--gut) 0.7rem;
}

.topbar__inner { display: grid; gap: 0.6rem; }

.topbar__row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

.topbar__name {
  font-size: var(--t-md); font-weight: 700; color: var(--surface);
  display: flex; align-items: baseline; gap: 0.5rem; min-width: 0;
}
.topbar__trade {
  font-size: var(--t-xs); font-weight: 400; color: #8b9aa4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Search is the first thing on screen because it answers the commonest
   question in the yard: "do you have one, and what does it cost?" */
.search { position: relative; display: flex; align-items: center; }
.search__icon {
  position: absolute; inset-inline-start: 0.7rem;
  width: 1.2rem; height: 1.2rem; color: var(--steel-1); pointer-events: none;
}
.search__input {
  width: 100%; min-height: 3rem;
  padding: 0.5rem 2.6rem;
  font: inherit; font-size: var(--t-md);
  color: var(--ink); background: var(--surface);
  border: 0; border-radius: var(--radius);
  appearance: none;
}
.search__input::-webkit-search-cancel-button { display: none; }
.search__clear {
  position: absolute; inset-inline-end: 0.25rem;
  display: grid; place-items: center;
  width: 2.4rem; height: 2.4rem;
  border: 0; background: transparent; color: var(--steel-1); cursor: pointer;
}
.search__clear svg { width: 1.1rem; height: 1.1rem; }

/* ───────────────────────────────────────────────────────────── chips ── */

.chips { display: flex; gap: 0.4rem; align-items: center; }
.chips--wrap { flex-wrap: wrap; }
.chips--tight { margin-top: 0.1rem; }

.chips--scroll {
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
  margin-inline: calc(var(--gut) * -1);
  padding-inline: var(--gut);
}
.chips--scroll::-webkit-scrollbar { display: none; }

.chips__split {
  width: 1px; height: 1.4rem; flex: 0 0 auto;
  background: rgba(125, 141, 153, 0.45);
  margin-inline: 0.2rem;
}

.chip {
  flex: 0 0 auto;
  min-height: 2.3rem;
  padding: 0.25rem 0.8rem;
  font: inherit; font-size: var(--t-sm); font-weight: 600;
  white-space: nowrap;
  border-radius: 3px;
  border: 1.5px solid var(--hair);
  background: var(--surface); color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Inside the ink topbar the unselected chips must not glare. */
.topbar .chip { background: transparent; border-color: rgba(125, 141, 153, 0.5); color: #c6d0d6; }
.topbar .chip.is-on { background: var(--surface); border-color: var(--surface); color: var(--ink); }
.topbar .chip--engine.is-on { background: var(--engine); border-color: var(--engine); color: #fff; }
.topbar .chip--gearbox.is-on { background: var(--gearbox); border-color: var(--gearbox); color: #fff; }

.chip--filter.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ─────────────────────────────────────────────────────────── listbar ── */

.listbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem var(--gut) 0.5rem;
  background: var(--plate);
  position: sticky; top: 0; z-index: 10;
}
.listbar__count { font-size: var(--t-sm); color: var(--steel-1); font-weight: 600; }

/* ──────────────────────────────────────────────────── the stock rows ── */

/* Rows are a ledger, not a feed of cards: full-bleed, hairline-ruled, each
   one wearing a coloured spine the way a part on the shelf wears a tag. */
.rows { background: var(--surface); border-block: 1px solid var(--hair); }

.row {
  display: grid;
  grid-template-columns: 5px auto 1fr;
  align-items: stretch;
  gap: 0 0.75rem;
  width: 100%;
  padding: 0; margin: 0;
  border: 0; border-bottom: 1px solid var(--hair-soft);
  background: var(--surface);
  text-align: start;
  font: inherit; color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rows > li:last-child .row { border-bottom: 0; }
.row:active { background: var(--plate); }

.row__spine { background: var(--steel-2); }
.row[data-cat='engine'] .row__spine { background: var(--engine); }
.row[data-cat='gearbox'] .row__spine { background: var(--gearbox); }

.row__thumb {
  width: 4.25rem; height: 4.25rem;
  margin-block: 0.7rem;
  margin-inline-start: 0.7rem;
  border-radius: 3px;
  background: var(--plate);
  display: grid; place-items: center;
  overflow: hidden; flex: 0 0 auto;
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row__thumb svg { width: 1.6rem; height: 1.6rem; color: var(--steel-2); }
.row[data-cat='engine'] .row__thumb--blank { background: var(--engine-soft); }
.row[data-cat='engine'] .row__thumb--blank svg { color: var(--engine); }
.row[data-cat='gearbox'] .row__thumb--blank { background: var(--gearbox-soft); }
.row[data-cat='gearbox'] .row__thumb--blank svg { color: var(--gearbox); }

.row__main {
  display: grid; gap: 0.3rem;
  padding-block: 0.7rem;
  padding-inline-end: 0.9rem;
  min-width: 0;
}

.row__title {
  font-size: var(--t-md); font-weight: 600; line-height: 1.4;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.row__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5rem; }

.row__tags { display: flex; flex-wrap: wrap; gap: 0.3rem; min-width: 0; }

/* A stencilled chip, the way a make is stamped on a crate. */
.tag {
  font-size: var(--t-xs); font-weight: 600; line-height: 1.5;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--hair);
  border-radius: 2px;
  color: var(--steel-1);
  white-space: nowrap;
}
.tag--make { color: var(--ink); border-color: var(--steel-2); }
.tag--working { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.tag--repair { color: var(--engine-ink); border-color: var(--engine); background: var(--engine-soft); }
.tag--parts { color: var(--steel-1); border-color: var(--steel-2); }
.tag--qty { color: var(--steel-1); }

/* The loudest thing on the row, because it is the answer he gives aloud. */
.row__price {
  display: flex; align-items: baseline; gap: 0.25rem;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.row__price b {
  font-size: var(--t-lg); font-weight: 700; line-height: 1.2;
  letter-spacing: -0.01em;
}
.row__price span { font-size: var(--t-xs); color: var(--steel-1); font-weight: 600; }
.row__price--none b { font-size: var(--t-md); color: var(--steel-2); font-weight: 600; }

/* Sold stock stays in the book but steps back out of the way. */
.row--sold { background: #fbfbfa; }
.row--sold .row__title,
.row--sold .row__price b { color: var(--steel-1); }
.row--sold .row__thumb img { filter: grayscale(1); opacity: 0.65; }
.tag--sold {
  color: var(--sold); border-color: var(--sold); background: var(--sold-soft);
}

.row--flash { animation: flash 1.4s ease-out; }
@keyframes flash {
  0%, 35% { background: var(--engine-soft); }
  100% { background: var(--surface); }
}
@media (prefers-reduced-motion: reduce) { .row--flash { animation: none; } }

/* ───────────────────────────────────────────────────────────── empty ── */

.empty { padding: 3.5rem var(--gut); text-align: center; display: grid; gap: 0.4rem; justify-items: center; }
.empty__mark { width: 2.75rem; height: 2.75rem; color: var(--hair); margin-bottom: 0.4rem; }
.empty__title { font-size: var(--t-md); font-weight: 600; }
.empty__hint { font-size: var(--t-sm); color: var(--steel-1); max-width: 24rem; }

/* ────────────────────────────────────────────────────────── fab area ── */

.fabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  padding: 0.65rem var(--gut) calc(0.65rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--plate) 65%, rgba(231, 236, 238, 0));
}

/* ──────────────────────────────────────────────────────────── sheets ── */

.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: var(--plate);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sheet--modal { background: var(--plate); }

.sheet__bar {
  display: flex; align-items: center; gap: 0.35rem;
  padding: calc(env(safe-area-inset-top) + 0.25rem) 0.35rem 0.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--hair);
  flex: 0 0 auto;
}
.sheet__heading { flex: 1 1 auto; text-align: center; font-size: var(--t-base); font-weight: 700; }
.sheet__spacer { width: 2.75rem; flex: 0 0 auto; }

.sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--gut) var(--gut) calc(2.5rem + env(safe-area-inset-bottom));
  display: grid; gap: 1.05rem; align-content: start;
}

.sheet__actions { display: grid; gap: 0.6rem; margin-top: 0.4rem; }

.sheet--in { animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(1.5rem); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet--in { animation: none; } }

/* ──────────────────────────────────────────────────────────── detail ── */

.detail__photo {
  width: 100%; aspect-ratio: 4 / 3;
  object-fit: cover; display: block;
  border-radius: var(--radius);
  background: var(--hair-soft);
}

.detail__head { display: grid; gap: 0.5rem; }
.detail__cat {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: var(--t-sm); font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
}
.detail__cat svg { width: 1.1rem; height: 1.1rem; }
.detail__cat[data-cat='engine'] { background: var(--engine-soft); color: var(--engine-ink); }
.detail__cat[data-cat='gearbox'] { background: var(--gearbox-soft); color: var(--gearbox-ink); }

.detail__title { font-size: var(--t-xl); font-weight: 700; line-height: 1.35; }

.detail__price {
  display: flex; align-items: baseline; gap: 0.4rem;
  font-variant-numeric: tabular-nums;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
}
.detail__price b { font-size: var(--t-2xl); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
.detail__price span { font-size: var(--t-base); color: var(--steel-1); font-weight: 600; }
.detail__price--none b { font-size: var(--t-lg); color: var(--steel-1); }

.specs { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); }
.spec {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--hair-soft);
}
.spec:last-child { border-bottom: 0; }
.spec__key { font-size: var(--t-sm); color: var(--steel-1); flex: 0 0 auto; }
.spec__val { font-weight: 600; text-align: end; overflow-wrap: anywhere; }

.detail__notes {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-inline-start: 4px solid var(--steel-2);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.detail__noteslabel { font-size: var(--t-sm); color: var(--steel-1); margin-bottom: 0.2rem; }

.stamp {
  justify-self: start;
  font-size: var(--t-sm); font-weight: 700;
  color: var(--sold);
  border: 2px solid var(--sold);
  border-radius: 3px;
  padding: 0.1rem 0.6rem;
}

/* ───────────────────────────────────────────────────────────── photo ── */

.photo { display: grid; gap: 0.6rem; }
.photo__img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius); background: var(--hair-soft); display: block;
}
.photo__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.photo__actions .btn { flex: 1 1 9rem; }
.photo__status { font-size: var(--t-sm); color: var(--steel-1); }

/* ──────────────────────────────────────────────────────────── notice ── */

.notice {
  font-size: var(--t-sm); font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  border-inline-start: 4px solid transparent;
}
.notice--error { background: var(--sold-soft); color: var(--sold); border-inline-start-color: var(--sold); }
.notice--ok { background: var(--ok-soft); color: var(--ok); border-inline-start-color: var(--ok); }

/* ─────────────────────────────────────────────────────────── setting ── */

.settings__who { font-size: var(--t-sm); color: var(--steel-1); }
.settings__who strong { color: var(--ink); }

.tally { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.tally__item {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  display: grid; gap: 0.1rem;
}
.tally__num { font-size: var(--t-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.tally__key { font-size: var(--t-sm); color: var(--steel-1); }
.tally__item--engine { border-inline-start: 4px solid var(--engine); }
.tally__item--gearbox { border-inline-start: 4px solid var(--gearbox); }
.tally__item--sold { border-inline-start: 4px solid var(--sold); }
.tally__item--all { border-inline-start: 4px solid var(--ink); }
/* The running total reads as the bottom line, not a stray cell. */
.tally__item:last-child:nth-child(odd) { grid-column: 1 / -1; }

.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: var(--gut);
  display: grid; gap: 0.85rem;
}
.card__title { font-size: var(--t-md); font-weight: 700; }

/* ──────────────────────────────────────────────────────────── modals ── */

.modal {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center;
  padding: var(--gut);
  background: rgba(19, 26, 31, 0.55);
}
.modal__panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  width: 100%; max-width: 22rem;
  display: grid; gap: 0.5rem;
}
.modal__title { font-size: var(--t-md); font-weight: 700; }
.modal__text { font-size: var(--t-sm); color: var(--steel-1); }
.modal__actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.modal__actions .btn { flex: 1 1 0; }

/* A pill, hugging its text — so it never reads as a second button stacked
   above the square-cornered one it floats over. */
.toast {
  position: fixed; z-index: 80;
  left: 50%; transform: translateX(-50%);
  bottom: calc(5.9rem + env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100% - var(--gut) * 2);
  background: var(--ink-soft); color: var(--surface);
  font-size: var(--t-sm); font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
  text-align: center;
}

/* ─────────────────────────────────────────────────────── wider phone ── */

/* The ink bar still spans the window; only what sits inside it is reined in. */
@media (min-width: 34rem) {
  :root { --gut: 1.4rem; }
  .signin__form, .modal__panel { max-width: 26rem; margin-inline: auto; width: 100%; }
  .topbar__inner, .sheet__body, .listbar { max-width: 40rem; margin-inline: auto; width: 100%; }
  .rows { max-width: 40rem; margin-inline: auto; border-inline: 1px solid var(--hair); }
  .fabbar { display: flex; justify-content: center; }
  .fabbar > .btn { max-width: 40rem; }
  .tally { grid-template-columns: repeat(4, 1fr); }
}
