:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-alt: #fafbfc;
  --border: #e4e7ec;
  --border-soft: #eef0f3;
  --text: #1d2433;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #2554d9;
  --accent-soft: #e8eefc;
  --ok: #0f7a4a;
  --ok-bg: #e5f4ec;
  --warn: #935700;
  --warn-bg: #fcf0d9;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --neutral: #475467;
  --neutral-bg: #eef0f3;
  --radius: 10px;
  --font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }

button { font: inherit; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 24px;
}

/* Pages with a wide table (the product list) use more of a wide screen. */
.page-wide .wrap { max-width: 1480px; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.unit { color: var(--muted); font-size: .8rem; font-weight: 400; }

.code {
  font-family: var(--mono);
  direction: ltr;
  unicode-bidi: isolate;
  letter-spacing: .02em;
}

/* ---- top bar ---- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand span {
  color: var(--muted);
  font-weight: 400;
  font-size: .88rem;
  padding-inline-start: 12px;
  border-inline-start: 1px solid var(--border);
}

main.wrap { padding-block: 28px 72px; }

/* ---- badges and chips ---- */

.badge {
  display: inline-block;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .8rem;
  line-height: 1.9;
  white-space: nowrap;
  background: var(--neutral-bg);
  color: var(--neutral);
}

.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-block;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--neutral);
  font-size: .82rem;
  line-height: 1.9;
}

a.chip:hover { border-color: var(--accent); color: var(--accent); }

.empty-state {
  padding: 32px 20px;
  color: var(--faint);
  text-align: center;
}

/* ---- search in the top bar (catalog/static/catalog/search.js) ---- */

.top-search { position: relative; margin-inline-start: auto; }

.top-search input {
  width: 280px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}

.top-search input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); background: var(--surface); }

.suggest {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: 20;
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
}

.suggest-item { display: block; padding: 7px 10px; border-radius: 7px; }
.suggest-item.active { background: var(--accent-soft); }
.suggest-head { display: flex; align-items: baseline; gap: 8px; }
.suggest-head .code { color: var(--accent); font-size: .85rem; }
.suggest-name { overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.suggest-facts { color: var(--muted); font-size: .78rem; }
.suggest-empty { padding: 10px; color: var(--faint); font-size: .88rem; }
.suggest-all { display: block; padding: 8px 10px 6px; border-top: 1px solid var(--border-soft); color: var(--accent); font-size: .84rem; }
.suggest-all:hover { text-decoration: underline; }

@media (max-width: 760px) {
  .top-search input { width: 160px; }
}

/* ---- product list ---- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 { margin: 0; font-size: 1.4rem; line-height: 1.5; }

.count { color: var(--muted); font-size: .88rem; }

.search input {
  width: 340px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search input:focus {
  outline: 3px solid var(--accent-soft);
  border-color: var(--accent);
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.products { width: 100%; border-collapse: collapse; }

.products th {
  padding: 11px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  text-align: start;
  white-space: nowrap;
}

.products td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.products tbody tr:last-child td { border-bottom: 0; }
.products tbody tr { cursor: pointer; transition: background .12s; }
.products tbody tr:hover { background: #f7f9ff; }
.products .name { font-weight: 500; min-width: 280px; }
.products .brand { min-width: 110px; max-width: 230px; }  /* long brand names wrap instead of widening the table */
.products td .code { color: var(--accent); }

/* The product list's filters (product_list.html). */
.list-filters {
  display: flex;
  flex-direction: column;  /* one filter per line (Sina, 2026-10-24) */
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .86rem;
}

.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.filter-title { min-width: 150px; color: var(--muted); font-weight: 500; }  /* lines the boxes up */
.filter-group label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.filter-group .faint { font-size: .76rem; }

/* ---- product page ---- */

.back { color: var(--muted); font-size: .88rem; }
.back:hover { color: var(--accent); }

.product-head { margin: 12px 0 20px; }
.product-head .pn { color: var(--muted); font-size: .95rem; display: inline-block; }
.product-head h1 { margin: 2px 0 12px; font-size: 1.45rem; line-height: 1.7; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.stat-label { color: var(--muted); font-size: .8rem; }
.stat-value { font-size: 1.2rem; font-weight: 700; white-space: nowrap; }

.section-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding-block: 10px;
  margin-bottom: 6px;
  background: var(--bg);
  overflow-x: auto;
}

.section-nav a {
  padding: 4px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .86rem;
  white-space: nowrap;
}

.section-nav a:hover { background: var(--surface); color: var(--text); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  scroll-margin-top: 60px;
}

.card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 { margin: 0; font-size: 1.02rem; }

.card-head .source {
  color: var(--faint);
  font-size: .8rem;
  direction: ltr;
  unicode-bidi: isolate;
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-inline-start: auto;
}

.updated { color: var(--muted); font-size: .8rem; }

.empty-toggle {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
}

.empty-toggle:hover { border-color: var(--accent); color: var(--accent); }

.card-body { padding: 4px 20px 12px; }

.group + .group { margin-top: 6px; }

.group-title {
  margin: 14px 0 2px;
  color: var(--faint);
  font-size: .76rem;
  font-weight: 500;
}

.field {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 90px;
  gap: 16px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}

.group .field:last-child { border-bottom: 0; }

.field-label { color: var(--muted); font-size: .86rem; }
.field-value { overflow-wrap: anywhere; }
.field.is-empty .field-value { color: var(--faint); }
.multiline { white-space: pre-line; }

.field-date {
  color: var(--faint);
  font-size: .76rem;
  text-align: end;
  white-space: nowrap;
}

.hide-empty .field.is-empty { display: none; }
.hide-empty .group:not(:has(.field:not(.is-empty))):not(:has(.chips)) { display: none; }

.html-preview {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-alt);
}

.html-source summary {
  margin-top: 4px;
  color: var(--faint);
  font-size: .78rem;
  cursor: pointer;
}

.html-source pre {
  max-height: 260px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-alt);
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: .76rem;
}

.attr-table { border-collapse: collapse; font-size: .9rem; }
.attr-table td { padding: 2px 0; padding-inline-end: 20px; }
.attr-table .faint { font-size: .78rem; }

.updated.link:hover { color: var(--accent); }

.notice {
  margin: 14px 0 4px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: .88rem;
}

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }

.thumbs img {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: contain;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #fff;
}

.thumbs a:hover img { border-color: var(--accent); }

/* ---- product tabs: shaped like browser tabs; the current one opens into the page below ---- */

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin: 4px 0 16px;
  padding: 6px 14px 0;
  border-radius: 12px 12px 0 0;
  background: #e4e7ec;
  overflow-x: auto;
}

.tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px 10px;
  border-radius: 10px 10px 0 0;
  color: var(--muted);
  white-space: nowrap;
  transition: background .12s;
}

.tabs a:not(.current):hover { background: rgba(255, 255, 255, .55); color: var(--text); }
.tabs a.current { z-index: 1; background: var(--bg); color: var(--text); font-weight: 500; }

/* The current tab's bottom corners curve out into the page (the page is right-to-left). */
.tabs a.current::before,
.tabs a.current::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 10px;
}

.tabs a.current::before { right: -10px; border-bottom-left-radius: 10px; box-shadow: -5px 5px 0 5px var(--bg); }
.tabs a.current::after { left: -10px; border-bottom-right-radius: 10px; box-shadow: 5px 5px 0 5px var(--bg); }

/* A thin divider between two tabs that aren't current. */
.tabs a:not(.current) + a:not(.current)::before {
  content: "";
  position: absolute;
  top: 11px;
  bottom: 11px;
  right: -2px;
  border-right: 1px solid #c5cad3;
}

.tab-note { color: var(--faint); font-size: .78rem; font-weight: 400; }

.tab-count,
.tab-found {
  padding: 0 8px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 500;
  line-height: 1.8;
}

.tab-count { background: var(--warn-bg); color: var(--warn); }
.tab-found { background: var(--accent-soft); color: var(--accent); }

/* ---- found on the web ---- */

.card-body .link { color: var(--accent); }
.card-body .link:hover { text-decoration: underline; }

.found-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding-block: 12px 6px;
}

.found-image { margin: 0; padding: 8px; border: 1px solid var(--border-soft); border-radius: 8px; }

.found-image img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.found-image a:hover img { outline: 2px solid var(--accent-soft); }
.found-image figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: .84rem; }
.found-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
.found-image .small { font-size: .76rem; }
.found-image .code { overflow-wrap: anywhere; }

.found-source { padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.found-source:last-child { border-bottom: 0; }
.found-source-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.found-source-head .faint { font-size: .8rem; }
.found-notes { margin-top: 4px; font-size: .9rem; }
.found-shared { align-items: center; margin-top: 6px; }

.found-prices { width: 100%; border-collapse: collapse; margin-block: 8px; font-size: .9rem; }
.found-prices th { padding: 4px 0; padding-inline-end: 16px; color: var(--faint); font-size: .76rem; font-weight: 500; text-align: start; }
.found-prices td { padding: 8px 0; padding-inline-end: 16px; border-top: 1px solid var(--border-soft); vertical-align: top; }

/* ---- pejmanpart draft ---- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.draft-form { margin-bottom: 0; }

.side {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .88rem;
}

.panel-card h3 { margin: 0 0 6px; font-size: .92rem; }
.panel-card h4 { margin: 12px 0 4px; color: var(--faint); font-size: .76rem; font-weight: 500; direction: ltr; text-align: right; }
.panel-card p { margin: 0 0 6px; }

.hint { color: var(--faint); font-size: .78rem; }
.hint .link, .panel-card .link { color: var(--accent); }
.saved, .ok-text { color: var(--ok); }
.saved { font-weight: 500; }

.change-list { margin: 0; padding-inline-start: 18px; }
.change-list a { color: var(--warn); }
.change-list a:hover { text-decoration: underline; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { position: relative; padding-inline-start: 20px; }
.checks li::before { position: absolute; inset-inline-start: 0; font-weight: 700; }
.checks li.pass::before { content: "✓"; color: var(--ok); }
.checks li.fail { color: var(--bad); }
.checks li.fail::before { content: "✗"; }

.sources dl { margin: 0; }
.sources dt { color: var(--muted); font-size: .76rem; }
.sources dd { margin: 0 0 6px; overflow-wrap: anywhere; }
.source-text { max-height: 180px; overflow-y: auto; font-size: .82rem; line-height: 1.8; }

.small-thumbs { margin: 4px 0 6px; }
.small-thumbs img { width: 64px; height: 64px; }
.thumb-add { padding: 0; border: 0; background: none; cursor: copy; }
.thumb-add:hover img { border-color: var(--accent); }

.draft-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 80px;
  gap: 16px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.group .draft-row:last-child { border-bottom: 0; }

/* A field that differs from the site: marked on the start side. */
.draft-row.is-changed {
  margin-inline-start: -20px;
  padding-inline-start: 17px;
  border-inline-start: 3px solid var(--warn);
}

.draft-input input[type=text],
.draft-input input[type=number],
.draft-input select,
.draft-input textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.draft-input input[type=number], .draft-input select { width: 220px; max-width: 100%; }
.draft-input textarea { display: block; resize: vertical; line-height: 1.8; }
.draft-input textarea.html-input { font-size: .85rem; }
.draft-input :is(input, select, textarea):focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.draft-input :is(input, select, textarea):disabled { background: var(--surface-alt); color: var(--muted); }
.draft-input .hint { margin-top: 2px; }
.counter.over { color: var(--bad); }
.error { margin-top: 2px; color: var(--bad); font-size: .8rem; }
.draft-input .live-preview { margin-top: 6px; }

.rule { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: .8rem; }
.rule-switch { display: inline-flex; align-items: center; gap: 4px; color: var(--text); cursor: pointer; }
.rule-note { color: var(--muted); }

.on-site { margin-top: 6px; color: var(--muted); font-size: .84rem; }
.on-site-label { color: var(--warn); font-weight: 500; }
.on-site summary { cursor: pointer; }
.on-site .html-preview { margin-top: 4px; }

.attr-edit { width: 100%; border-collapse: collapse; }
.attr-edit th { color: var(--faint); font-size: .76rem; font-weight: 500; text-align: start; padding-bottom: 2px; }
.attr-edit td { padding: 2px 0; padding-inline-end: 8px; }
.attr-edit td:nth-child(n+3) { width: 56px; text-align: center; }

.form-foot { display: flex; align-items: center; gap: 10px; padding: 14px 0 6px; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }

.draft-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.draft-toolbar .hint { flex: 1 1 320px; line-height: 1.8; }
.toolbar-end { margin-inline-start: auto; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
}

@media (max-width: 760px) {
  .wrap { padding-inline: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .field { grid-template-columns: 1fr; gap: 0; }
  .field-date { text-align: start; }
  .draft-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---- photo editor (photo_editor.html, editor.js) ---- */

.editor-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  padding: 16px 20px 20px;
  align-items: start;
}

.editor-side { display: flex; flex-direction: column; gap: 12px; }
.tool { padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.tool:last-child { padding-bottom: 0; border-bottom: 0; }
.tool h3 { margin: 0 0 6px; color: var(--muted); font-size: .86rem; font-weight: 500; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.tool .hint { margin: 4px 0 0; }
.tool label.btn { cursor: pointer; }

.shelf-title { margin: 6px 0 4px; color: var(--faint); font-size: .76rem; }
.shelf { display: flex; flex-wrap: wrap; gap: 6px; }

.pick {
  padding: 0;
  border: 2px solid var(--border-soft);
  border-radius: 8px;
  background: #fff;
  line-height: 0;
  cursor: pointer;
}

.pick img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; }
.pick:hover { border-color: var(--accent-soft); }
.pick.current { border-color: var(--accent); }
.pick.none { width: 60px; height: 60px; color: var(--muted); font-size: .74rem; line-height: 1.3; border-style: dashed; }
.logo-pick img { background: repeating-conic-gradient(#aeb4bf 0 25%, #c9ced6 0 50%) 0 0 / 10px 10px; }  /* grey, so white logos show too */

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { padding: 2px 10px; border: 0; background: var(--surface); color: var(--muted); font-size: .8rem; cursor: pointer; }
.segmented button + button { border-inline-start: 1px solid var(--border); }
.segmented button.current { background: var(--accent-soft); color: var(--accent); }

.slider { display: grid; grid-template-columns: 82px minmax(0, 1fr) 44px; align-items: center; gap: 8px; margin: 4px 0; font-size: .84rem; }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider select { font: inherit; font-size: .82rem; }
.slider output { color: var(--muted); font-size: .8rem; }
.slider-label { width: 82px; font-size: .84rem; }

/* the logo's corner: a little photo with a button in each corner, laid out as it looks */
.corner-pick {
  display: inline-grid;
  grid-template-columns: 18px 18px;
  grid-template-rows: 12px 12px;
  justify-content: space-between;
  align-content: space-between;
  width: 64px;
  height: 48px;
  padding: 4px;
  box-sizing: border-box;
  direction: ltr;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.corner-pick button { padding: 0; border: 1px solid var(--border); border-radius: 3px; background: var(--surface); cursor: pointer; }
.corner-pick button:hover { border-color: var(--accent); }
.corner-pick button.current { border-color: var(--accent); background: var(--accent); }

.text-logo { margin: 8px 0 4px; padding: 6px 10px; border: 1px solid var(--border-soft); border-radius: 8px; font-size: .84rem; }
.text-logo summary { color: var(--accent); cursor: pointer; }
.text-logo input[type="text"] { width: 100%; margin-top: 6px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.text-logo select { font: inherit; font-size: .8rem; }
.text-logo input[type="color"] { width: 32px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 4px; }
.text-preview { margin: 6px 0; padding: 6px; border-radius: 6px; text-align: center; background: repeating-conic-gradient(#c9ced6 0 25%, #e9ebef 0 50%) 0 0 / 12px 12px; }
.text-preview:empty { display: none; }
.text-preview-canvas { max-width: 100%; max-height: 60px; }

.editor-main { min-width: 0; }

/* the photo queue (temporary, catalog/photo_queue.py) */
.queue-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 12px;
  padding: 8px 14px;
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: .9rem;
}
.queue-nav { display: flex; gap: 6px; margin-inline-start: auto; }
.queue-hint { margin: 0 0 10px; }
.queue .queue-done td { background: var(--ok-bg); }
.stage-modes { margin-bottom: 10px; text-align: center; }
.stage-modes .segmented button { padding: 4px 16px; font-size: .86rem; }

.editor-stage {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  direction: ltr;
  touch-action: none;
  user-select: none;
  background: repeating-conic-gradient(#e9ebef 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.editor-stage canvas { display: block; }

.crop-box {
  position: absolute;
  outline: 1px solid #fff;
  box-shadow: 0 0 0 9999px rgba(15, 20, 30, .55);
  cursor: move;
}

.crop-box .handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  background: #fff;
}

.crop-box .handle[data-corner="nw"] { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-box .handle[data-corner="ne"] { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-box .handle[data-corner="sw"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-box .handle[data-corner="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }

.logo-box { position: absolute; outline: 1px dashed rgba(255, 255, 255, .85); cursor: move; }
.logo-box img { display: block; width: 100%; height: auto; pointer-events: none; }

.logo-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  cursor: nwse-resize;
}

.live-size { margin: 8px 0 0; color: var(--muted); font-size: .9rem; text-align: center; min-height: 1.5em; transition: opacity .15s; }
.live-size.working { opacity: .45; }
.stage-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.saved-note { margin: 8px 0 0; color: var(--ok); font-size: .86rem; text-align: center; }
.editor-main > .notice { text-align: center; }
.made { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.made-title { margin-bottom: 8px; color: var(--muted); font-size: .86rem; font-weight: 500; }
.made-list { display: flex; flex-wrap: wrap; gap: 10px; }
.made-photo { width: 160px; margin: 0; padding: 6px; border: 2px solid var(--border-soft); border-radius: 8px; }
.made-photo.current { border-color: var(--accent); }
.made-photo img { display: block; width: 100%; height: 130px; object-fit: contain; background: #fff; border-radius: 4px; }
.made-photo figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: .74rem; }
.made-photo .code { overflow-wrap: anywhere; }
.made-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; margin-top: 2px; }  /* wraps rather than spill out of the card */
.made-actions .btn.small { padding-inline: 8px; }
.pick.made-pick { border-style: dashed; border-color: var(--ok); }
.pick.made-pick.current { border-style: solid; border-color: var(--accent); }
.pick.site-pick { display: inline-block; border-style: dotted; }  /* the site's photos: links to look at, not pictures to pick */
.pick.used { position: relative; }
.pick.used::after {
  content: "✓";
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.ready-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.ready-actions form { display: inline; }
.found-image .make { font-size: .76rem; }

@media (max-width: 880px) {
  .editor-body { grid-template-columns: 1fr; }
}

/* ---- warehouse count («شمارش انبار», stock_count.html) ---- */

.count-summary { margin-top: 4px; font-size: .95rem; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.count-help { margin: -6px 0 12px; color: var(--muted); font-size: .8rem; }
.count-help kbd {
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font: .75rem var(--mono);
}
.count-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: .86rem;
}
.count-add[hidden] { display: none; }
.count-add input, .count-table input {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.count-add input:focus, .count-table input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.count-table tbody tr { cursor: default; }
.count-table td { padding-block: 8px; }
.count-table .name { min-width: 240px; }
.count-table .report-name { color: var(--muted); font-size: .78rem; font-weight: 400; }
.count-table .expected { font-weight: 600; }
.count-table .report-date { color: var(--muted); font-size: .72rem; font-weight: 400; line-height: 1.3; }
.count-input { width: 76px; text-align: center; font-weight: 600; font-size: 1rem; direction: ltr; }
.count-input.error { border-color: var(--bad); background: var(--bad-bg); }
.location-input { width: 110px; font-size: .9rem; }
/* Counted, but where it was found isn't written yet: strong enough to show on a mismatch's pink row too. */
.count-table tr:not(.todo) .location-input:placeholder-shown {
  border: 2px solid var(--bad);
  background: #f9c9c3;
}
.count-table tr:not(.todo) .location-input:placeholder-shown::placeholder { color: var(--bad); font-weight: 700; opacity: 1; }
.note-input { width: 300px; font-size: .82rem; }
.count-table .checked-cell { text-align: center; }
.checked-input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--ok); }
.save-state { display: inline-block; width: 18px; margin-inline-start: 4px; color: var(--ok); font-size: .8rem; }
.count-table tr.ok { background: #f3faf6; }
.count-table tr.diff { background: #fef5f4; }
.count-table tr.ok .diff { color: var(--ok); }
.count-table tr.diff .diff { color: var(--bad); font-weight: 700; }
.count-table tr.ok:hover { background: #e9f5ee; }
.count-table tr.diff:hover { background: #fdeceb; }

/* ---- our buys («خریدها», stock/templates/stock/purchases.html) ---- */

.buy-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .86rem;
}
.buy-filters label, .view-switch { display: flex; flex-direction: column; gap: 3px; }
.buy-filters label > span, .view-switch > span { color: var(--muted); font-size: .78rem; font-weight: 500; }
.buy-filters input, .buy-filters select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.buy-filters :is(input, select):focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.buy-filters .wide input { width: 300px; max-width: 100%; }
.buy-filters input.ltr, .buy-filters input.date { width: 130px; direction: ltr; text-align: right; }
.buy-filters select { max-width: 240px; }
.view-switch div { display: flex; gap: 12px; padding-block: 6px; }
.view-switch label { flex-direction: row; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.buy-actions { display: flex; gap: 8px; margin-inline-start: auto; }

#results.loading { opacity: .55; transition: opacity .15s .1s; }

.buy-read { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; line-height: 1.9; }
.buy-read .code { color: inherit; text-decoration: underline; }
.buy-read summary { cursor: pointer; }
.buy-read ul { margin: 4px 0 0; padding-inline-start: 20px; color: var(--text); font-size: .82rem; }
#buy-load .btn.disabled, #buy-fetch .btn.disabled { opacity: .5; pointer-events: none; }
#buy-load, #buy-fetch { display: inline-flex; margin: 0; }

.buy-part { margin-bottom: 14px; }
.buy-part-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 10px; }
.buy-part-head h2 { margin: 0; font-size: 1.15rem; }
.buy-part-head .pn { color: var(--muted); }
.buy-part .link { color: var(--accent); font-size: .88rem; }
.buy-part .link:hover { text-decoration: underline; }
.buy-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

.buy-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; margin-bottom: 8px; }
.buy-summary { font-size: .92rem; }
.col-chooser { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; color: var(--muted); font-size: .8rem; }
.col-chooser label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.col-title { font-weight: 500; }
.col-reset { padding: 0; border: 0; background: none; color: var(--accent); font-size: .78rem; cursor: pointer; }
.col-reset:hover { text-decoration: underline; }

.buys th a { display: inline-flex; gap: 3px; }
.buys th a:hover { color: var(--accent); }
.buys th .arrow { color: var(--accent); }
.buys td { padding-block: 9px; }
.buys .name { font-weight: 400; min-width: 260px; }
.buys .num { white-space: nowrap; }  /* right-aligned like the text, so the units digits line up */
.buys .date { white-space: nowrap; }
.buys .address { max-width: 240px; color: var(--muted); font-size: .82rem; }
.buys td a.code:hover { text-decoration: underline; }
.buys .in-app {
  margin-inline-start: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: .72rem;
}
.buys .in-app:hover { text-decoration: underline; }
.buys td .link { color: var(--accent); font-size: .85rem; }
.buys[data-view="lines"] tbody tr { cursor: default; }
.buys tfoot td { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-alt); font-weight: 700; }
.buy-more { margin-top: 10px; color: var(--muted); font-size: .86rem; }
.buy-more .link { color: var(--accent); }

/* ---- our sales («فروش‌ها», stock/templates/stock/sales.html; the rest is shared with the buys above) ---- */

#sale-pull .btn.disabled { opacity: .5; pointer-events: none; }
.sales .customer { white-space: nowrap; }
.sales .item { min-width: 220px; color: var(--muted); font-size: .82rem; }
.sales .note { min-width: 200px; color: var(--muted); font-size: .8rem; }
.sales td .badge { margin-inline-start: 4px; font-size: .7rem; line-height: 1.7; }
.sales tr.gone td:not([data-col="invoice"]) { color: var(--faint); text-decoration: line-through; }
.sales tr.mismatch td[data-col="description"] { background: var(--warn-bg); }
.sale-item-note { margin-top: 3px; color: var(--warn); font-size: .76rem; }
.stat-link { display: block; color: inherit; }
.stat-link:hover { border-color: var(--accent); }
.stat-link:hover .stat-label { color: var(--accent); }
.sale-elsewhere { margin: 0 0 14px; background: var(--warn-bg); color: var(--warn); }
.sale-elsewhere summary { cursor: pointer; line-height: 1.8; }
.sale-elsewhere table.mini { margin-top: 8px; background: var(--surface); color: var(--text); font-size: .84rem; }
.sale-elsewhere table.mini td, .sale-elsewhere table.mini th { padding: 6px 10px; }
.sale-elsewhere .code { color: var(--accent); }

/* ---- the read-only copy on the server (catalog/readonly.py) ---- */
.copy-info { display: flex; align-items: center; gap: 12px; margin-inline-start: 16px; font-size: .84rem; white-space: nowrap; }
.top-search + .copy-info { margin-inline-start: 16px; }
.topnav + .copy-info { margin-inline-start: auto; }
.copy-info form { margin: 0; }
.img-off {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--faint);
  font-size: .8rem;
  text-align: center;
}
.found-image .img-off { width: 100%; aspect-ratio: 4 / 3; }
.plain-fieldset { border: 0; margin: 0; min-width: 0; }
.read-only .draft-input input:disabled, .read-only .draft-input textarea:disabled, .read-only .draft-input select:disabled {
  color: var(--text);
  background: var(--surface-alt);
  -webkit-text-fill-color: var(--text);
  opacity: 1;
}
.read-only .count-table input[readonly] { background: transparent; border-color: transparent; }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-box { width: min(360px, 100% - 32px); display: grid; gap: 16px; justify-items: center; }
.login-form { width: 100%; display: grid; gap: 14px; padding: 24px; }
.login-form label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.login-form input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.login-form .notice { margin: 0; }
