/*
 * catalog.css — the price list (מחירון) and its add/edit sheet, `tally:catalog`
 * (2026-10-24, Almon). screens/catalog.js + js/catalog.js. Colours through the
 * tokens only, so all three designs and both modes follow; design M's etched
 * line is added in design-etched.css with the other panes.
 */

/* ---- The screen ---------------------------------------------------------- */

.catalog__title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.catalog__title { margin: 0; }
.catalog__count { display: block; margin-block-start: 2px; color: var(--text-muted); font-size: 0.875rem; }
.catalog__add { inline-size: auto; min-block-size: 42px; padding-inline: 18px; flex: none; font-size: 0.9375rem; }
.catalog__lede { margin: 8px 0 16px; color: var(--text-muted); font-size: 0.875rem; line-height: 1.5; max-inline-size: 46ch; }
/* Keep the top-right clear of the account button on phones with the bar. */
@media (max-width: 1023px) {
  html[data-nav="bar"] .catalog__title-row { padding-inline-end: 52px; }
}

.catalog__filters { margin-block-start: -6px; }
.catalog__search-row { flex-direction: row; align-items: center; gap: 8px; }
.catalog__search-row .search-field { flex: 1 1 auto; min-inline-size: 0; }
.catalog__sort {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 48px;
  padding-inline: 14px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.catalog__sort[hidden] { display: none; }
.catalog-icon { display: inline-flex; }
.catalog-icon svg { inline-size: 16px; block-size: 16px; }

.catalog-list {
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.catalog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  inline-size: 100%;
  min-block-size: 72px;
  padding: 14px 16px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
}
button.catalog-row { cursor: pointer; }
button.catalog-row:active { background: var(--accent-soft); }
@media (hover: hover) { button.catalog-row:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); } }
.catalog-row + .catalog-row { border-block-start: 1px solid var(--border); }
.catalog-row.is-flash { animation: catalog-flash 1.6s ease; }
@keyframes catalog-flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }

.catalog-row__main { display: flex; align-items: center; gap: 12px; min-inline-size: 0; }
.catalog-row__kind {
  flex: none;
  inline-size: 38px;
  block-size: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.catalog-row__kind--service { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.catalog-row__kind svg { inline-size: 19px; block-size: 19px; }
.catalog-row__text { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; }
.catalog-row__name { font-weight: 600; overflow-wrap: anywhere; }
.catalog-row__desc {
  color: var(--text-muted);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-row__meta { color: var(--text-muted); font-size: 0.75rem; }

.catalog-row__price { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; text-align: end; }
.catalog-row__amount { font-size: 1.125rem; font-weight: 700; color: var(--value); }
.catalog-row__amount.is-blank { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); }
.catalog-row__vat { color: var(--text-muted); font-size: 0.75rem; }
html[data-design="etched"] .catalog-row__amount { font-family: "Heebo", system-ui, sans-serif; font-weight: 400; font-size: 1.25rem; }

.catalog__empty-search { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-block: 20px; }
.catalog__empty-search .btn { inline-size: auto; padding-inline: 18px; }
.catalog__none { margin: 0; }

.catalog__empty { text-align: center; }
.catalog__empty .btn { inline-size: auto; padding-inline: 22px; margin-block-start: 8px; }
.catalog-sample {
  margin: 0 auto 18px;
  max-inline-size: 260px;
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm);
  transform: rotate(-2deg);
}
.catalog-sample__row { display: flex; justify-content: space-between; gap: 12px; padding-block: 8px; font-size: 0.875rem; color: var(--text-muted); }
.catalog-sample__row + .catalog-sample__row { border-block-start: 1px dashed var(--border); }
.catalog-sample__row .num { color: var(--text); font-weight: 600; }

/* ---- The add / edit sheet (openCatalogEditor) ---------------------------- */

.cat-sheet { z-index: 210; }
.cat-sheet.is-closing { animation: confirm-fade .16s ease reverse forwards; }
.cat-sheet__card {
  max-inline-size: 480px;
  max-block-size: calc(100dvh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 18px 18px;
  background: var(--bg-raise);
  backdrop-filter: var(--surface-blur);
  -webkit-backdrop-filter: var(--surface-blur);
}
html[data-design="etched"] .cat-sheet__card { background: color-mix(in srgb, var(--bg-raise) 92%, transparent); outline: 1px solid var(--etch); outline-offset: -7px; }
.cat-sheet__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cat-sheet__head .confirm-sheet__title { margin: 0; }
.cat-sheet__used { color: var(--text-muted); font-size: 0.8125rem; }
.cat-sheet__card .field { margin: 0; }
.cat-sheet__desc { resize: vertical; min-block-size: 60px; padding-block: 10px; line-height: 1.4; }

/* Two-, three-way switches: kind, currency. Selected = filled (C) / clear (M). */
.cat-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}
.cat-seg__opt {
  flex: 1 1 0;
  min-block-size: 40px;
  padding-inline: 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.cat-seg__opt.is-selected { background: var(--bg-raise); color: var(--accent); box-shadow: var(--shadow-sm); }
html[data-design="etched"] .cat-seg__opt.is-selected { background: transparent; box-shadow: var(--clear-ring); }
.cat-seg--currency { flex: none; }
.cat-seg--currency .cat-seg__opt { flex: none; inline-size: 44px; padding: 0; font-size: 1.0625rem; }

.cat-price { display: flex; gap: 8px; align-items: stretch; }
.cat-price .field-input { flex: 1 1 auto; min-inline-size: 0; font-size: 1.25rem; font-weight: 600; -moz-appearance: textfield; }
.cat-price .field-input::-webkit-inner-spin-button, .cat-price .field-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.cat-units { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-units__chip {
  min-block-size: 36px;
  padding-inline: 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.cat-units__chip.is-selected { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); font-weight: 600; }
html[data-design="etched"] .cat-units__chip.is-selected { background: transparent; box-shadow: var(--clear-ring); }
.cat-units__other { flex: 1 1 110px; min-block-size: 36px; border-radius: var(--radius-pill); padding-inline: 14px; font-size: 0.875rem; }
.cat-units__other.is-selected { box-shadow: inset 0 0 0 1.5px var(--accent); }

.cat-sheet__vat { min-block-size: 40px; font-weight: 500; }

.cat-sum {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}
.cat-sum__cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.cat-sum__cell + .cat-sum__cell { border-inline-start: 1px solid var(--border); }
.cat-sum__label { color: var(--text-muted); font-size: 0.75rem; }
.cat-sum__value { font-weight: 600; font-size: 0.9375rem; display: block; text-align: start; }
.cat-sum__cell.is-main .cat-sum__value { color: var(--accent); font-size: 1.0625rem; }

.cat-sheet__actions { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-block-start: 4px; }
.cat-sheet__delete {
  align-self: center;
  min-block-size: 40px;
  padding-inline: 12px;
  border: 0;
  background: none;
  color: var(--neg);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---- The type-ahead on the expense form (catalogCombo) ------------------- */

.cat-combo__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cat-combo__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-combo__meta { flex: none; color: var(--text-muted); font-size: 0.8125rem; }
.combo__item.is-active { background: var(--surface); }

/* The quantity line under the description once an item is picked. */
.cat-qty {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-block-start: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 0.875rem;
}
.cat-qty__stepper { display: inline-flex; align-items: center; border-radius: var(--radius-pill); background: var(--bg-raise); box-shadow: inset 0 0 0 1px var(--border); }
.cat-qty__btn {
  inline-size: 34px;
  block-size: 34px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
}
.cat-qty__input {
  inline-size: 52px;
  block-size: 34px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}
.cat-qty__input::-webkit-inner-spin-button, .cat-qty__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cat-qty__calc { color: var(--text-muted); }
.cat-qty__calc strong { color: var(--text); }
.cat-qty__clear {
  margin-inline-start: auto;
  min-block-size: 32px;
  padding-inline: 8px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.cat-qty__note { flex-basis: 100%; color: var(--text-muted); font-size: 0.8125rem; }
