:root {
  --brand: #e8501e;
  --brand-600: #cf4416;
  --brand-50: #fff1eb;
  --brand-100: #ffe0d3;
  --ink: #1f1b18;
  --ink-2: #57514b;
  --ink-3: #8b847c;
  --line: #e9e4de;
  --line-2: #f1ede8;
  --bg: #f6f4f1;
  --surface: #ffffff;
  --special: #ffc21a;
  --special-ink: #5a3f00;
  --ok: #1f8a4c;
  --danger: #c62828;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 27, 24, .06), 0 4px 16px rgba(31, 27, 24, .06);
  --shadow-lg: 0 10px 40px rgba(31, 27, 24, .18);
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
  --header-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.num, .price, .mono { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: none; }
.logo img { height: 38px; width: auto; border-radius: 8px; }
.logo span { font-weight: 700; font-size: 15px; color: var(--ink-2); white-space: nowrap; }
.search {
  flex: 1; min-width: 120px; max-width: 620px; position: relative;
}
.search input {
  width: 100%; height: 42px; border: 1.5px solid var(--line); background: var(--bg);
  border-radius: 12px; padding-inline: 40px 36px; outline: none; transition: border-color .15s, background .15s;
}
.search input:focus { border-color: var(--brand); background: #fff; }
.search .ico { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .clear { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--ink-3); width: 30px; height: 30px; border-radius: 8px; }
.search .clear:hover { background: var(--line-2); }
.hgroup { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.select-pill {
  height: 40px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface);
  padding-inline: 10px 28px; font-weight: 600; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2357514b' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
[dir=rtl] .select-pill { background-position: left 10px center; }
.select-pill:hover { border-color: #d6cfc7; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 14px;
  border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover { border-color: #d6cfc7; background: #fbfaf8; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 32px; padding: 0 10px; border-radius: 9px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn svg { flex: none; }
.cart-btn { position: relative; }
.cart-btn .count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #fff; color: var(--brand);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.cart-btn .tot { font-weight: 700; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 20px; padding: 20px; max-width: 1680px; margin: 0 auto; }
.sidebar { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; padding-inline-end: 4px; scrollbar-width: thin; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 14px; }
.panel h3 { margin: 6px 8px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.cats { list-style: none; margin: 0; padding: 0; }
.cats button {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: start;
  padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 500;
}
.cats button:hover { background: var(--line-2); color: var(--ink); }
.cats button.active { background: var(--brand-50); color: var(--brand-600); font-weight: 700; }
.cats .n { margin-inline-start: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cats button.active .n { color: var(--brand); }
.cats .star { width: 18px; height: 18px; border-radius: 50%; background: var(--special); color: var(--special-ink); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cats .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; margin-inline: 5px; }
.cats button.active .dot { background: var(--brand); }

.facet { padding: 6px 8px 10px; border-top: 1px solid var(--line-2); }
.facet:first-of-type { border-top: 0; }
.facet h4 { margin: 8px 0; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.facet h4 button { border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 600; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); display: inline-flex; gap: 5px; align-items: center; font-variant-numeric: tabular-nums;
  transition: border-color .12s, background .12s, color .12s;
}
.chip:hover { border-color: #cfc7be; color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .c { font-weight: 500; opacity: .55; font-size: 11px; }
.chip.on .c { opacity: .75; }
.range { display: flex; gap: 6px; align-items: center; }
.range input { width: 100%; height: 34px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 9px; outline: none; }
.range input:focus { border-color: var(--brand); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.switch input:focus-visible + .tg { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch .tg { width: 36px; height: 21px; border-radius: 11px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .tg::after { content: ""; position: absolute; top: 2.5px; inset-inline-start: 2.5px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .tg { background: var(--brand); }
.switch input:checked + .tg::after { transform: translateX(15px); }
[dir=rtl] .switch input:checked + .tg::after { transform: translateX(-15px); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h1 { font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.toolbar .found { color: var(--ink-3); font-weight: 500; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; height: 37px; padding: 0 11px; color: var(--ink-3); display: inline-flex; align-items: center; }
.seg button.on { background: var(--ink); color: #fff; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-filters:empty { display: none; }
.af { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-50); color: var(--brand-600); border: 1px solid var(--brand-100); border-radius: 999px; padding: 4px 6px 4px 11px; font-weight: 600; font-size: 13px; }
.af button { border: 0; background: rgba(232,80,30,.12); color: var(--brand-600); width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; font-size: 14px; line-height: 1; }
.af.reset { background: none; border-color: transparent; color: var(--ink-3); cursor: pointer; padding: 4px 8px; }
.af.reset:hover { color: var(--ink); }
.mobile-only { display: none !important; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: box-shadow .18s, transform .18s, border-color .18s; position: relative;
}
.card:hover { box-shadow: var(--shadow); border-color: #e0d9d1; }
.card .ph { position: relative; aspect-ratio: 16 / 10.4; background: #fff; cursor: zoom-in; overflow: hidden; border-bottom: 1px solid var(--line-2); }
.card .ph img { width: 100%; height: 100%; object-fit: contain; transition: transform .35s ease; }
.card:hover .ph img { transform: scale(1.03); }
.badge-special {
  position: absolute; top: 10px; inset-inline-start: 10px; display: inline-flex; align-items: center; gap: 5px;
  background: var(--special); color: var(--special-ink); font-weight: 800; font-size: 12px; padding: 4px 10px 4px 4px;
  border-radius: 999px; box-shadow: 0 2px 6px rgba(150,100,0,.25);
}
[dir=rtl] .badge-special { padding: 4px 4px 4px 10px; }
.badge-special i { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; color: #c98a00; }
.tag-state { position: absolute; bottom: 8px; inset-inline-start: 10px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag-state.new { background: var(--ok); }
.edit-btn {
  position: absolute; top: 8px; inset-inline-end: 8px; width: 34px; height: 34px; border-radius: 10px; border: 0;
  background: rgba(31,27,24,.82); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.edit-btn:hover { background: var(--brand); }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card .model { font-size: 17px; font-weight: 800; letter-spacing: -.01em; direction: ltr; unicode-bidi: isolate; }
.card .cat { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-align: end; }
.specs { display: flex; flex-wrap: wrap; gap: 5px; }
.spec { font-size: 12px; background: var(--line-2); color: var(--ink-2); padding: 2px 8px; border-radius: 6px; unicode-bidi: plaintext; }
.spec.k { background: #fff6e0; color: #7a5200; font-weight: 700; }
.ctn { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.prices { display: flex; flex-direction: column; gap: 5px; margin-top: auto; padding-top: 4px; }
.pbtn {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 6px 6px 6px 11px; text-align: start; transition: border-color .12s, background .12s;
}
[dir=rtl] .pbtn { padding: 6px 11px 6px 6px; }
.pbtn:hover { border-color: var(--brand); background: var(--brand-50); }
.pbtn .lbl { color: var(--ink-2); font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbtn .val { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pbtn .add { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pbtn.in { border-color: var(--ok); background: #effaf3; }
.pbtn.in .add { background: var(--ok); }
.pbtn.single { padding-block: 9px; }
.pbtn.single .val { font-size: 19px; }
.pbtn .q { font-size: 11px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.onreq { color: var(--ink-3); font-weight: 600; padding: 9px 0; }

/* list view */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 96px 150px minmax(0, 1fr) minmax(260px, 340px); gap: 14px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-2); position: relative; }
.row:first-child { border-top: 0; }
.row:hover { background: #fcfbfa; }
.row .ph { width: 96px; height: 62px; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--line-2); cursor: zoom-in; position: relative; }
.row .ph img { width: 100%; height: 100%; object-fit: contain; }
.row .ph .dotsp { position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--special); color: var(--special-ink); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.row .model { font-weight: 800; font-size: 15px; direction: ltr; unicode-bidi: isolate; }
.row .sub { font-size: 12px; color: var(--ink-3); }
.row .prices { flex-direction: row; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; }
.row .pbtn { width: auto; padding: 4px 4px 4px 9px; gap: 6px; }
.row .pbtn .lbl { font-size: 12px; }
.row .pbtn .val { font-size: 13.5px; }
.row .pbtn .add { width: 22px; height: 22px; border-radius: 6px; }
.row .edit-btn { position: static; width: 30px; height: 30px; }

.empty { text-align: center; padding: 70px 20px; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty b { display: block; font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.more { display: flex; justify-content: center; padding: 20px; }

/* ---------- drawer & modals ---------- */
.scrim { position: fixed; inset: 0; background: rgba(31,27,24,.42); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 100vw); background: var(--surface); z-index: 70;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .25s cubic-bezier(.3,.7,.2,1);
}
[dir=rtl] .drawer { transform: translateX(-105%); }
.drawer.show { transform: none !important; }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 18px; flex: 1; }
.drawer-b { flex: 1; overflow: auto; padding: 8px 18px; }
.drawer-f { border-top: 1px solid var(--line); padding: 14px 18px; background: #fcfbfa; }
.cline { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.cline:last-child { border-bottom: 0; }
.cline .ph { width: 64px; height: 46px; border-radius: 8px; border: 1px solid var(--line-2); overflow: hidden; background: #fff; }
.cline .ph img { width: 100%; height: 100%; object-fit: contain; }
.cline .t { display: flex; align-items: center; gap: 8px; }
.cline .t b { font-size: 15px; direction: ltr; unicode-bidi: isolate; }
.cline .t .x { margin-inline-start: auto; border: 0; background: none; color: var(--ink-3); width: 28px; height: 28px; border-radius: 8px; }
.cline .t .x:hover { background: #fdecec; color: var(--danger); }
.cline .ctl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; align-items: center; }
.cline select, .cline input, .field input, .field select, .field textarea {
  height: 34px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 9px; background: #fff; outline: none;
}
.cline select:focus, .cline input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.cline select { max-width: 190px; }
.cline .qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.cline .qty input { border: 0; width: 76px; text-align: center; border-radius: 0; height: 31px; }
.cline .qty button { border: 0; background: var(--line-2); width: 30px; height: 31px; font-weight: 700; }
.cline .qty button:hover { background: var(--line); }
.cline .custom { width: 96px; }
.cline .meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.cline .sum { margin-inline-start: auto; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.totals { display: grid; gap: 4px; margin-bottom: 12px; }
.totals .r { display: flex; justify-content: space-between; color: var(--ink-2); }
.totals .r.big { font-size: 20px; font-weight: 800; color: var(--ink); }
.totals .r input { width: 70px; height: 28px; border: 1.5px solid var(--line); border-radius: 7px; padding: 0 6px; text-align: end; }
.drawer-f .acts { display: flex; gap: 8px; }
.drawer-f .acts .primary { flex: 1; }

.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; pointer-events: none; }
.modal.show { pointer-events: auto; }
.modal .box {
  background: var(--surface); border-radius: 18px; width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .18s, transform .18s;
}
.modal.show .box { opacity: 1; transform: none; }
.modal .box .mh { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .box .mh h2 { margin: 0; font-size: 18px; flex: 1; }
.modal .box .mb { padding: 18px 20px; overflow: auto; }
.modal .box .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .box .mf .left { margin-inline-end: auto; display: flex; gap: 8px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.fgrid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.field textarea { height: auto; min-height: 90px; padding: 8px 9px; resize: vertical; line-height: 1.5; }
.sect { margin: 22px 0 10px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-600); display: flex; align-items: center; gap: 8px; }
.sect:first-child { margin-top: 0; }
.vrow { display: grid; grid-template-columns: minmax(0, 1fr) 120px 34px; gap: 8px; margin-bottom: 8px; }
.vrow input { height: 36px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 10px; outline: none; background: #fff; min-width: 0; }
.vrow input:focus { border-color: var(--brand); }
.vrow button { border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-3); }
.vrow button:hover { color: var(--danger); border-color: #f2c4c4; }
.photo-edit { display: flex; gap: 14px; align-items: center; }
.photo-edit .pv { width: 180px; aspect-ratio: 16/10.4; border: 1.5px dashed var(--line); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--ink-3); flex: none; }
.photo-edit .pv img { width: 100%; height: 100%; object-fit: contain; }
.detected { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); align-items: center; }
.cur-table { width: 100%; border-collapse: collapse; }
.cur-table th { font-size: 12px; text-align: start; color: var(--ink-3); font-weight: 700; padding: 4px 6px; }
.cur-table td { padding: 4px 6px; }
.cur-table input { width: 100%; height: 34px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 8px; outline: none; }
.cur-table input:focus { border-color: var(--brand); }
.cur-table .base input { background: var(--line-2); }
.note { background: #fff8e6; border: 1px solid #f5e1a8; color: #6b5310; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.note.info { background: #eef5ff; border-color: #cfe0fb; color: #23436f; }
.db-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.pill.warn { background: #fff1e0; color: #a05a00; }
.pill.ok { background: #e7f6ed; color: var(--ok); }
.unsaved-dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 9px; height: 9px; border-radius: 50%; background: #ff9800; border: 2px solid #fff; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(20,17,15,.92); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .18s; }
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox figure { margin: 0; max-width: min(1200px, 92vw); text-align: center; color: #fff; }
.lightbox img { max-height: 78vh; width: auto; margin: 0 auto; border-radius: 12px; background: #fff; }
.lightbox figcaption { margin-top: 12px; font-size: 16px; }
.lightbox figcaption b { font-size: 20px; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 24px; }
.lightbox .nav:hover { background: rgba(255,255,255,.25); }
.lightbox .prev { inset-inline-start: 20px; }
.lightbox .next { inset-inline-end: 20px; }
.lightbox .close { position: absolute; top: 16px; inset-inline-end: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 22px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 100; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: var(--shadow-lg); max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.totop { position: fixed; bottom: 22px; inset-inline-end: 22px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; display: flex; align-items: center; justify-content: center; }
.totop.show { opacity: 1; pointer-events: auto; }

/* ---------- quote view ---------- */
.quote-view { position: fixed; inset: 0; z-index: 75; background: #e9e6e2; display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.quote-side { background: var(--surface); border-inline-end: 1px solid var(--line); overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.quote-side h2 { margin: 0 0 4px; font-size: 18px; }
.quote-side .acts { display: grid; gap: 8px; }
.quote-scroll { overflow: auto; padding: 28px; }
.saved-list { display: grid; gap: 6px; }
.saved-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.saved-item .i { flex: 1; min-width: 0; }
.saved-item .i b { display: block; font-size: 13px; }
.saved-item .i small { color: var(--ink-3); }

.paper {
  width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; box-shadow: 0 6px 30px rgba(0,0,0,.12); padding: 14mm 13mm;
  color: #1a1a1a; font-size: 11.5px; line-height: 1.4;
}
.paper .q-head { display: flex; align-items: stretch; gap: 16px; border-bottom: 3px solid var(--brand); padding-bottom: 12px; }
.paper .q-logo { height: 54px; width: auto; border-radius: 6px; }
.paper .q-title { flex: 1; text-align: end; }
.paper .q-title h1 { margin: 0; font-size: 22px; letter-spacing: .02em; color: var(--brand-600); text-transform: uppercase; }
.paper .q-title div { color: #555; margin-top: 2px; }
.paper .q-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.paper .q-parties > div { background: #faf8f6; border: 1px solid #eee7e1; border-radius: 8px; padding: 9px 11px; }
.paper .q-parties h4 { margin: 0 0 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #999; }
.paper .q-parties b { font-size: 13px; }
.paper table.q { width: 100%; border-collapse: collapse; }
.paper table.q th { background: #2a2420; color: #fff; font-size: 10.5px; font-weight: 700; padding: 7px 6px; text-align: start; }
.paper table.q th.r, .paper table.q td.r { text-align: end; }
.paper table.q td { border-bottom: 1px solid #ece7e2; padding: 6px; vertical-align: middle; }
.paper table.q tr { break-inside: avoid; page-break-inside: avoid; }
.paper table.q tbody tr:nth-child(even) td { background: #fbfaf9; }
.paper table.q .qimg { width: 70px; height: 46px; object-fit: contain; display: block; }
.paper table.q .m { font-weight: 800; font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
.paper table.q .s { color: #666; font-size: 10px; }
.paper table.q .sp { display: inline-block; background: var(--special); color: var(--special-ink); font-size: 9px; font-weight: 800; padding: 0 5px; border-radius: 4px; margin-inline-start: 4px; vertical-align: 1px; }
.paper .q-totals { display: flex; justify-content: space-between; gap: 20px; margin-top: 12px; break-inside: avoid; }
.paper .q-totals .sum { min-width: 250px; }
.paper .q-totals .sum div { display: flex; justify-content: space-between; padding: 3px 0; }
.paper .q-totals .sum .grand { border-top: 2px solid #1a1a1a; margin-top: 4px; padding-top: 6px; font-size: 16px; font-weight: 800; }
.paper .q-totals .left { color: #555; }
.paper .q-notes { margin-top: 14px; white-space: pre-wrap; break-inside: avoid; }
.paper .q-notes h4 { margin: 0 0 3px; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #999; }
.paper .q-foot { margin-top: 26px; display: flex; justify-content: space-between; gap: 20px; break-inside: avoid; color: #555; }
.paper .q-foot .sig { border-top: 1px solid #999; min-width: 200px; padding-top: 4px; text-align: center; font-size: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .row { grid-template-columns: 80px 120px minmax(0, 1fr); }
  .row .prices { grid-column: 2 / -1; }
  .row .ph { width: 80px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(340px, 88vw); max-height: none; z-index: 70;
    background: var(--bg); padding: 14px; transform: translateX(-105%); transition: transform .25s; box-shadow: var(--shadow-lg);
  }
  [dir=rtl] .sidebar { transform: translateX(105%); }
  .sidebar.show { transform: none !important; }
  .mobile-only { display: inline-flex !important; }
  .logo span, .hide-m { display: none; }
  .header { padding: 0 12px; gap: 8px; }
  .quote-view { grid-template-columns: 1fr; overflow: auto; }
  .quote-side { border: 0; }
  .quote-scroll { padding: 10px; overflow: visible; }
  .paper { width: 100%; min-height: 0; padding: 16px; }
}
@media (max-width: 600px) {
  :root { --header-h: 112px; }
  .header { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
  .row { grid-template-columns: 72px minmax(0, 1fr); }
  .row > :nth-child(3) { grid-column: 1 / -1; }
  .row .prices { grid-column: 1 / -1; }
  .toolbar h1 { font-size: 18px; }
  .fgrid { grid-template-columns: 1fr; }
  .cart-btn .tot { display: none; }
  .photo-edit { flex-direction: column; align-items: stretch; }
  .photo-edit .pv { width: 100%; }
}

/* ---------- print: only the quotation sheet ---------- */
@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff; }
  body > *:not(.print-target) { display: none !important; }
  .b-x { display: none !important; }
  .quote-view { position: static; display: block; background: #fff; }
  .quote-side { display: none !important; }
  .quote-scroll { padding: 0; overflow: visible; }
  .paper { width: auto; min-height: 0; box-shadow: none; padding: 0; margin: 0; }
  .paper table.q th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- cart: centred dialog with a table of lines ---------- */
.drawer.cart-modal {
  inset: auto; top: 50%; left: 50%;
  width: min(1180px, calc(100vw - 48px)); height: min(860px, calc(100vh - 48px));
  border-radius: 20px; overflow: hidden;
  transform: translate(-50%, -48%) scale(.98) !important; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .22s cubic-bezier(.3,.7,.2,1);
}
.drawer.cart-modal.show { transform: translate(-50%, -50%) !important; opacity: 1; pointer-events: auto; }
.cart-modal .drawer-h { padding: 18px 24px; }
.cart-modal .drawer-h h2 { font-size: 20px; }
.cart-modal .drawer-b { padding: 0 24px 8px; }
.cart-modal .ct-head, .cart-modal .cline {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 92px minmax(180px, 1.5fr) minmax(170px, 1fr) 170px 150px 130px 36px;
}
.cart-modal .ct-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 12px 0 10px; border-bottom: 2px solid var(--line);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3);
}
.cart-modal .ct-head .r, .cart-modal .cline .r { text-align: end; justify-content: flex-end; }
.cart-modal .cline { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.cart-modal .cline:hover { background: #fcfbfa; }
.cart-modal .cline .ph { position: relative; width: 92px; height: 60px; border-radius: 10px; }
.cart-modal .cline .ph .no { position: absolute; top: 3px; inset-inline-start: 3px; min-width: 18px; height: 18px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.cart-modal .info { min-width: 0; }
.cart-modal .info .t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cart-modal .info .t b { font-size: 16px; }
.cart-modal .info .sp { background: var(--special); color: var(--special-ink); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.cart-modal .specs-line { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cart-modal .c-var select { width: 100%; max-width: none; height: 38px; }
.cart-modal .muted { color: var(--ink-3); }
.cart-modal .c-qty, .cart-modal .c-price { display: flex; flex-direction: column; gap: 4px; }
.cart-modal .c-price { align-items: flex-end; }
.cart-modal .c-qty small, .cart-modal .c-price small { font-size: 11.5px; color: var(--ink-3); }
.cart-modal .c-price small.cust { color: var(--brand-600); }
.cart-modal .qty { display: inline-flex; width: max-content; }
.cart-modal .qty input { width: 80px; height: 36px; font-weight: 700; }
.cart-modal .qty button { width: 34px; height: 36px; font-size: 16px; }
.cart-modal .pwrap { display: inline-flex; align-items: center; gap: 4px; }
.cart-modal input.custom { width: 110px; height: 38px; text-align: end; font-weight: 700; }
.cart-modal input.custom.is-custom { border-color: var(--brand); background: var(--brand-50); }
.cart-modal .reset { border: 0; background: var(--line-2); width: 30px; height: 30px; border-radius: 8px; color: var(--ink-2); }
.cart-modal .reset:hover { background: var(--brand-100); color: var(--brand-600); }
.cart-modal .c-sum { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-modal .cline .x { border: 0; background: none; color: var(--ink-3); width: 34px; height: 34px; border-radius: 9px; }
.cart-modal .cline .x:hover { background: #fdecec; color: var(--danger); }
.cart-modal input[type=number]::-webkit-inner-spin-button, .cart-modal input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cart-modal input[type=number] { -moz-appearance: textfield; }
.cart-modal .drawer-f { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 16px 24px; }
.cart-modal .foot-left { display: flex; gap: 22px; flex-wrap: wrap; color: var(--ink-2); padding-bottom: 6px; }
.cart-modal .foot-left b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cart-modal .foot-right { width: min(380px, 100%); }
.cart-modal .totals { margin-bottom: 10px; }
.cart-modal .acts .primary { height: 48px; font-size: 16px; }
@media (max-width: 1000px) {
  .drawer.cart-modal { width: calc(100vw - 20px); height: calc(100vh - 20px); border-radius: 16px; }
  .cart-modal .ct-head { display: none; }
  .cart-modal .cline { grid-template-columns: 72px minmax(0, 1fr) 36px; gap: 8px 12px; padding: 14px 0; }
  .cart-modal .cline .ph { width: 72px; height: 50px; grid-row: span 1; }
  .cart-modal .cline .x { grid-column: 3; grid-row: 1; }
  .cart-modal .c-var, .cart-modal .c-qty, .cart-modal .c-price, .cart-modal .c-sum { grid-column: 1 / -1; display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 10px; text-align: start; }
  .cart-modal .c-var::before, .cart-modal .c-qty::before, .cart-modal .c-price::before, .cart-modal .c-sum::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--ink-3); }
  .cart-modal .c-price { align-items: center; }
  .cart-modal .c-qty small, .cart-modal .c-price small { grid-column: 2; }
  .cart-modal .cline .r { justify-content: flex-start; }
  .cart-modal .drawer-f { flex-direction: column; align-items: stretch; }
  .cart-modal .foot-right { width: 100%; }
}
.cart-modal .totals .r { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
@media (max-width: 1000px) {
  .cart-modal .drawer-f { gap: 8px; padding: 12px 16px; }
  .cart-modal .foot-left { gap: 4px 14px; font-size: 12.5px; padding: 0; }
  .cart-modal .totals { gap: 2px; margin-bottom: 8px; }
  .cart-modal .totals .r.big { font-size: 18px; }
  .cart-modal .drawer-h { padding: 12px 16px; }
  .cart-modal .drawer-b { padding: 0 16px 8px; }
}
@media (max-width: 1000px) {
  .cart-modal .cline .c-price, .cart-modal .cline .c-sum { text-align: start; justify-items: start; align-items: center; }
  .cart-modal .c-price small.cust { grid-column: 2; }
}

/* ---------- clients ---------- */
.client-pick { position: relative; }
.linked { display: flex; align-items: center; gap: 8px; background: #effaf3; border: 1px solid #cde9d7; color: #1d5e37; border-radius: 10px; padding: 6px 6px 6px 10px; font-size: 13px; }
.linked span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest { position: absolute; z-index: 5; inset-inline: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.suggest button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; padding: 8px 12px; text-align: start; border-bottom: 1px solid var(--line-2); }
.suggest button:hover { background: var(--brand-50); }
.suggest small { color: var(--ink-3); font-size: 12px; }
.cl-list { display: grid; gap: 6px; }
.cl-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; }
.cl-row:hover { border-color: var(--brand); background: var(--brand-50); }
.cl-row .av { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.cl-row .i { min-width: 0; }
.cl-row .i b, .cl-row .i small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-row small { color: var(--ink-3); font-size: 12px; }
.cl-row .st { text-align: end; font-size: 13px; color: var(--ink-2); }
.cl-row .st small { display: block; }
.hist { display: grid; gap: 6px; }
.hist .saved-item .num { white-space: nowrap; }
#modalBox .search input { padding-inline: 14px; }

/* ---------- excel preview ---------- */
.xl-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.xl-table { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 52vh; }
.xl-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.xl-table th { position: sticky; top: 0; background: var(--bg); text-align: start; padding: 8px 10px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.xl-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.xl-table td.b { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.xl-table td.a { font-weight: 600; }
.tagc { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.tagc.p { background: #fff1e0; color: #a05a00; }
.tagc.o { background: #eef5ff; color: #23436f; }
.tagc.n { background: #e7f6ed; color: var(--ok); }
.tagc.d { background: #fdecec; color: var(--danger); }

/* ---------- PDF selection (brochure) ---------- */
.paper.brochure .q-head { margin-bottom: 6px; }
.paper .b-contacts { color: #666; font-size: 10.5px; margin: 6px 0 12px; }
.paper .b-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
.paper .b-card { position: relative; border: 1px solid #ebe5df; border-radius: 9px; padding: 7px; break-inside: avoid; page-break-inside: avoid; display: flex; flex-direction: column; gap: 3px; background: #fff; }
.paper .b-ph { position: relative; aspect-ratio: 16 / 10.4; border-radius: 6px; overflow: hidden; background: #fff; }
.paper .b-ph img { width: 100%; height: 100%; object-fit: contain; }
.paper .b-sp { position: absolute; top: 4px; inset-inline-start: 4px; background: var(--special); color: var(--special-ink); font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.paper .b-m { font-weight: 800; font-size: 13px; direction: ltr; unicode-bidi: isolate; text-align: start; }
.paper .b-s { color: #666; font-size: 9.5px; line-height: 1.35; }
.paper .b-c { color: #888; font-size: 9.5px; }
.paper .b-prices { margin-top: auto; border-top: 1px dashed #e5dfd8; padding-top: 4px; display: grid; gap: 1px; }
.paper .bp { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; }
.paper .bp b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper .b-x { position: absolute; top: 4px; inset-inline-end: 4px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(31,27,24,.75); color: #fff; font-size: 12px; opacity: 0; transition: opacity .15s; }
.paper .b-card:hover .b-x { opacity: 1; }
.paper .b-x:hover { background: var(--danger); }
@media (hover: none) { .paper .b-x { opacity: .8; } }
@media (max-width: 600px) { .paper .b-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
.field > .field { gap: 5px; }
.quote-side { overflow-x: hidden; }
@media (max-width: 600px) { .fgrid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- names, tags, compare button ---------- */
.card .pname, .row .pname { font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-top: -4px; }
.row .pname { margin-top: 1px; }
.badges { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; z-index: 1; }
.badges .badge-special { position: static; }
.tagb { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.tagb.sm { font-size: 10.5px; padding: 1px 7px; box-shadow: none; vertical-align: 2px; margin-inline-start: 4px; }
.tag-new { background: #1f8a4c; color: #fff; }
.tag-hit { background: #d62f2f; color: #fff; }
.tag-out { background: #57514b; color: #fff; }
.tag-sp { background: var(--special); color: var(--special-ink); }
.card.out .ph img, .row.out .ph img { filter: grayscale(.85); opacity: .6; }
.card.out .pbtn, .row.out .pbtn { opacity: .65; }
.cmp-btn { position: absolute; bottom: 8px; inset-inline-end: 8px; width: 34px; height: 30px; border-radius: 9px; border: 1.5px solid var(--line); background: rgba(255,255,255,.92); color: var(--ink-2); font-size: 15px; font-weight: 700; z-index: 1; }
.cmp-btn:hover { border-color: var(--ink); color: var(--ink); }
.cmp-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cmp-btn.sm { position: static; width: 26px; height: 22px; font-size: 12px; margin-inline-end: 6px; border-radius: 6px; vertical-align: 0; }
.ph-count { position: absolute; bottom: 8px; inset-inline-end: 48px; background: rgba(31,27,24,.72); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 7px; }

/* compare tray + table */
.cmp-tray { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 16px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px); overflow-x: auto; }
.cmp-tray .lbl { font-weight: 700; padding: 0 6px; white-space: nowrap; }
.cmp-tray .it { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); padding: 4px 4px 4px 4px; border-radius: 10px; white-space: nowrap; }
.cmp-tray .it img { width: 38px; height: 26px; object-fit: contain; background: #fff; border-radius: 5px; }
.cmp-tray .it b { font-size: 12.5px; }
.cmp-tray .it button { border: 0; background: none; color: #fff; opacity: .7; width: 22px; height: 22px; border-radius: 6px; }
.cmp-tray .it button:hover { opacity: 1; background: rgba(255,255,255,.15); }
.cmp-tray .btn.ghost { color: #fff; }
.cmp-tray .btn.ghost:hover { background: rgba(255,255,255,.12); }
.cmp-tray .btn[disabled] { opacity: .5; cursor: default; }
.cmp-wrap { overflow-x: auto; }
.cmp-table { border-collapse: collapse; width: 100%; min-width: 640px; table-layout: fixed; }
.cmp-table th { width: 140px; text-align: start; vertical-align: top; font-size: 12px; color: var(--ink-3); font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--line-2); }
.cmp-table td { vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.cmp-table tr:nth-child(even) td { background: #fcfbfa; }
.cmp-table .cmp-ph { aspect-ratio: 16/10.4; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.cmp-table .cmp-ph img { width: 100%; height: 100%; object-fit: contain; }
.cmp-table .mdl { font-size: 16px; }
.cmp-table .pname { font-size: 12.5px; color: var(--ink-2); margin: 2px 0 4px; }
.cmp-table .best { color: var(--ok); }
.cmp-table .prices { margin: 0; padding: 0; }
.cmp-table .pbtn { padding: 4px 4px 4px 9px; }
.cmp-table .pbtn .val { font-size: 13.5px; }
.cmp-table .pbtn .add { width: 22px; height: 22px; }

/* xwide modal */
.modal .box.xwide { width: min(1200px, 100%); }

/* ---------- product window ---------- */
.modal .box .mh h2 .mdl { direction: ltr; unicode-bidi: isolate; }
.modal .box .mh h2 small { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.pm-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; }
.pm-main { position: relative; aspect-ratio: 16/10.4; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; cursor: zoom-in; }
.pm-main img { width: 100%; height: 100%; object-fit: contain; }
.pm-main .zoom { position: absolute; bottom: 10px; inset-inline-end: 10px; background: rgba(31,27,24,.7); color: #fff; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; pointer-events: none; }
.pm-main .gnav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(31,27,24,.6); color: #fff; font-size: 22px; line-height: 1; }
.pm-main .gnav:hover { background: var(--brand); }
.pm-main .gnav.l { left: 10px; } .pm-main .gnav.r { right: 10px; }
.pm-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.pm-thumbs button { flex: none; width: 84px; height: 56px; border: 2px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; padding: 0; }
.pm-thumbs button.on { border-color: var(--brand); }
.pm-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pm-info { display: flex; flex-direction: column; gap: 12px; }
.pm-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pm-badges .cat { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-inline-end: 4px; }
.pm-attrs { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.pm-attrs th { text-align: start; color: var(--ink-3); font-weight: 600; padding: 5px 0; width: 46%; border-bottom: 1px solid var(--line-2); }
.pm-attrs td { font-weight: 700; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.pm-info .prices { margin: 0; padding: 0; }
.pm-acts { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; }
.pm-acts .cmp-btn { position: static; }
.pm-acts .btn { margin-inline-start: auto; }
.mini-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mini { display: flex; flex-direction: column; gap: 2px; text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 7px; }
.mini:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.mini .ph { position: relative; aspect-ratio: 16/10.4; border-radius: 8px; overflow: hidden; background: #fff; margin-bottom: 4px; }
.mini .ph img { width: 100%; height: 100%; object-fit: contain; }
.mini .ph i { position: absolute; top: 4px; inset-inline-start: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--special); color: var(--special-ink); font-style: normal; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.mini b { font-size: 13.5px; direction: ltr; unicode-bidi: isolate; text-align: start; }
.mini small { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .pr { font-size: 13px; font-weight: 800; }
.mini .pr em { font-style: normal; color: var(--ok); font-size: 12px; }
@media (max-width: 800px) { .pm-grid { grid-template-columns: 1fr; } }

/* ---------- gallery editor ---------- */
.gal-edit { display: flex; flex-wrap: wrap; gap: 10px; }
.gal-edit .gi { position: relative; width: 150px; aspect-ratio: 16/10.4; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.gal-edit .gi.main { border-color: var(--brand); }
.gal-edit .gi img { width: 100%; height: 100%; object-fit: contain; }
.gal-edit .gi .mainlbl { position: absolute; bottom: 4px; inset-inline-start: 4px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.gal-edit .gi .gm, .gal-edit .gi .gd { position: absolute; top: 4px; width: 24px; height: 24px; border-radius: 7px; border: 0; background: rgba(31,27,24,.72); color: #fff; font-size: 12px; }
.gal-edit .gi .gm { inset-inline-start: 4px; }
.gal-edit .gi .gd { inset-inline-end: 4px; }
.gal-edit .gi .gd:hover { background: var(--danger); }
.gal-edit .gi .gm:hover { background: var(--brand); }
.gal-edit .gi.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-style: dashed; color: var(--ink-3); font-size: 26px; cursor: pointer; }
.gal-edit .gi.add span { font-size: 12px; font-weight: 600; }
.gal-edit .gi.add:hover { border-color: var(--brand); color: var(--brand); }
.chip.tagchip { cursor: pointer; }
.chip.tagchip input { margin: 0; accent-color: var(--brand); }

/* ---------- statuses, journal, tabs ---------- */
.st { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.st-draft { background: var(--line-2); color: var(--ink-2); }
.st-sent { background: #eef5ff; color: #23436f; }
.st-agreed { background: #fff1e0; color: #a05a00; }
.st-paid { background: #e7f6ed; color: var(--ok); }
.st-rejected { background: #fdecec; color: var(--danger); }
select.st-sel { height: 32px; border-radius: 8px; border: 1px solid var(--line); padding: 0 8px; font-weight: 700; font-size: 12.5px; }
.tabs { display: inline-flex; background: var(--line-2); border-radius: 11px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 700; color: var(--ink-3); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.jr-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.jr-filters select { height: 34px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 9px; }
.jr-total { margin: 4px 0 12px; color: var(--ink-2); }
.saved-item.jr { flex-wrap: wrap; }
.st-chip.on .c { opacity: .8; }

/* ---------- settings: templates, rates, translations ---------- */
.tpl-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 36px; gap: 8px; margin: 8px 0; align-items: start; }
.tpl-row input, .tpl-row textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 9px; padding: 7px 9px; outline: none; font: inherit; }
.tpl-row input:focus, .tpl-row textarea:focus { border-color: var(--brand); }
.tpl-row textarea { resize: vertical; min-height: 38px; }
@media (max-width: 600px) { .tpl-row { grid-template-columns: minmax(0, 1fr) 36px; } .tpl-row textarea { grid-column: 1 / 2; } }
.rates-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fcfbfa; }
.rates-box .rb-h { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.rates-box small.warn { color: #a05a00; font-weight: 700; }
.tr-table { max-height: 60vh; }
.tr-table td { padding: 4px 6px; }
.tr-table td.src { min-width: 180px; }
.tr-table td.src small { color: var(--ink-3); font-size: 11px; }
.tr-table input { width: 100%; min-width: 130px; height: 32px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 8px; outline: none; }
.tr-table input:focus { border-color: var(--brand); }
.tr-table input.set { border-color: #9fd3b4; background: #f2fbf6; }
.tr-table input.miss { background: #fff1f3; border-color: #f4c7cf; }

/* ---------- quote/brochure: product names ---------- */
.paper table.q .n { font-size: 10.5px; color: #333; font-weight: 600; }
.paper .b-n { font-size: 10px; color: #444; font-weight: 600; margin-top: -2px; }
@media print { .cmp-tray { display: none !important; } }

.chip.tagchip { white-space: nowrap; }

/* ---------- Urdu: Nastaliq (bundled, offline; Arabic-script glyphs only, Latin/digits stay in the UI font) ---------- */
@font-face { font-family: 'Noto Nastaliq Urdu'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/noto-nastaliq-urdu-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Noto Nastaliq Urdu'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/noto-nastaliq-urdu-arabic-700-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
:lang(ur) { font-family: 'Noto Nastaliq Urdu', var(--font); line-height: 2.1; }
:lang(ur) h1, :lang(ur) h2, :lang(ur) h3, :lang(ur) h4 { line-height: 2; }
:lang(ur) .btn, :lang(ur) .chip, :lang(ur) .select-pill, :lang(ur) .seg button, :lang(ur) .pbtn, :lang(ur) .tagb, :lang(ur) .badge-special, :lang(ur) .af, :lang(ur) .pill, :lang(ur) .st {
  height: auto; min-height: 40px; line-height: 1.9; padding-block: 2px; }
:lang(ur) .btn.sm, :lang(ur) .chip, :lang(ur) .tagb, :lang(ur) .badge-special, :lang(ur) .af, :lang(ur) .pill, :lang(ur) .st { min-height: 30px; line-height: 1.8; }
:lang(ur) .pbtn .lbl, :lang(ur) .cats button, :lang(ur) .spec { line-height: 2; }
:lang(ur) .field input, :lang(ur) .field select, :lang(ur) .cline select, :lang(ur) .search input { line-height: 1.9; }
:lang(ur) .toolbar h1 { font-size: 20px; }
:lang(ur) .sect, :lang(ur) .panel h3 { letter-spacing: 0; text-transform: none; }
.paper:lang(ur) { line-height: 2; font-size: 11px; }
.paper:lang(ur) table.q th { line-height: 1.8; padding-block: 6px; }
.paper:lang(ur) .q-title h1 { letter-spacing: 0; text-transform: none; font-size: 22px; }
/* Arabic & other scripts: never letter-space or upper-case */
:lang(ar) .sect, :lang(ar) .panel h3, :lang(zh) .sect, :lang(zh) .panel h3 { letter-spacing: 0; }
.paper:lang(ar) .q-title h1, .paper:lang(zh) .q-title h1 { letter-spacing: 0; }

/* ---------- interface language picker: short code in the header, full names in the list ---------- */
.lang-pick { position: relative; display: inline-flex; align-items: center; min-width: 64px; cursor: pointer; }
.lang-pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 15px; }
.lang-pick:focus-within { border-color: var(--brand); }

/* ---------- document language / currency boxes ---------- */
.doc-box { display: grid; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--brand-100); background: var(--brand-50); border-radius: 12px; }
.doc-box .note { font-size: 12.5px; }
.doc-box .btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.doc-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; padding: 12px 0 4px; }
.doc-bar .field { flex: 1 1 180px; }
.doc-bar select { width: 100%; }

/* ---------- quotes found from the catalog search ---------- */
.qhits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; padding: 8px 10px; background: #eef5ff; border: 1px solid #cfe0fb; border-radius: 12px; }
.qhits > b { color: #23436f; margin-inline-end: 4px; }
.qhit { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #cfe0fb; background: #fff; border-radius: 10px; padding: 5px 10px; font-size: 13px; text-align: start; }
.qhit:hover { border-color: #23436f; }
.qhit span { color: var(--ink-2); }
.qhit .go { color: var(--brand-600); font-weight: 700; white-space: nowrap; }

/* ---------- reference (manager) line in documents ---------- */
.paper .ref { display: block; color: #8b847c; font-size: 9px; font-weight: 500; line-height: 1.35; unicode-bidi: plaintext; text-transform: none; letter-spacing: 0; }
.paper td .ref { margin-top: 2px; font-style: italic; }
.paper table.q th .ref { color: rgba(255, 255, 255, .62); font-size: 8.5px; font-weight: 500; }
.paper .q-title h1 .ref { font-size: 10px; letter-spacing: .04em; color: #b7aea5; }
.paper h4 .ref { display: inline; margin-inline-start: 6px; font-size: 9px; }
.paper .q-totals .sum .ref { display: inline; margin-inline-start: 6px; font-size: 9px; }
.paper .q-no { font-size: 13px; }
.paper .q-no b { font-size: 15px; letter-spacing: .02em; }
.paper table.q td.no, .paper table.q th.no { width: 26px; text-align: center; font-weight: 700; }
.paper .b-ref { font-size: 9px; color: #8b847c; font-style: italic; margin-top: -2px; }
.paper .ref:lang(ur) { font-family: 'Noto Nastaliq Urdu', var(--font); line-height: 2; font-style: normal; }
.cline .pname { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.lang-pick span { white-space: nowrap; }
@media (max-width: 600px) {
  .hgroup { flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 100%; margin-inline-start: auto; }
  .hgroup .btn.icon { width: 36px; height: 36px; }
  .hgroup .select-pill { height: 36px; padding-inline: 8px 22px; background-position: right 7px center; }
  [dir=rtl] .hgroup .select-pill { background-position: left 7px center; padding-inline: 22px 8px; }
  .hgroup .lang-pick { min-width: 58px; }
  .cart-btn { height: 36px; padding: 0 10px; gap: 5px; }
}
/* keep notifications above the compare tray */
body:has(#cmpTray:not([hidden])) .toast { bottom: 86px; }

.paper table.q td.no, .paper table.q th.no { width: 34px; }
.paper bdi { unicode-bidi: isolate; }
.paper table.q td.var { white-space: nowrap; }
/* phone numbers, e-mails and sites are always typed left-to-right, also in Arabic/Urdu */
[data-c=phone], [data-clf=phone], [data-clf=email], [data-s="manager.phone"], [data-s="manager.email"], [data-s="manager.wechat"], [data-s="company.site"] { direction: ltr; }
[dir=rtl] [data-c=phone], [dir=rtl] [data-clf=phone], [dir=rtl] [data-clf=email], [dir=rtl] [data-s="manager.phone"], [dir=rtl] [data-s="manager.email"], [dir=rtl] [data-s="manager.wechat"], [dir=rtl] [data-s="company.site"] { text-align: right; }

/* reference-language line in the interface (helps reading a client's screenshot) */
.pref { font-size: 11.5px; color: var(--ink-3); font-style: italic; margin-top: -6px; unicode-bidi: plaintext; }
.row .pref, .cline .pref, .cmp-table .pref { margin-top: 0; }
.modal .box .mh h2 small.pref { display: block; font-size: 12px; font-weight: 500; margin-top: 0; }
.mini small.pref { font-size: 10.5px; }
/* reference line in documents: a little larger and darker so it stays readable on screenshots */
.paper .ref { font-size: 9.5px; color: #6f6862; }
.paper .b-ref { font-size: 9.5px; color: #6f6862; }

/* ===== online mode (website) ===== */
body.gated > :not(#gate):not(#toast):not(script) { display: none !important; }
#gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg, #f6f7f9); }
.gate-box { width: 100%; max-width: 440px; background: var(--surface); border-radius: 16px; padding: 24px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.gate-box h1 { font-size: 22px; margin: 14px 0 4px; }
.gate-box > p { color: var(--ink-3, #666); margin: 0 0 16px; }
.gate-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gate-top img { height: 34px; }
.gate-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.gate-tabs button { flex: 1; padding: 8px 10px; border: 1px solid var(--line, #ddd); background: transparent; border-radius: 10px; cursor: pointer; font: inherit; }
.gate-tabs button.on { background: var(--brand); border-color: transparent; color: #fff; font-weight: 600; }
#gateForm { display: grid; gap: 10px; }
#gateForm .field { display: grid; gap: 4px; }
#gateForm .field span { font-size: 13px; color: var(--ink-3, #666); }
#gateForm input, #gateForm select { width: 100%; height: auto; min-height: 44px; line-height: 1.3; padding: 10px 12px; border: 1px solid var(--line, #ddd); border-radius: 10px; font: inherit; background: #fff; box-sizing: border-box; }
#gateForm .fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#gateForm .btn.primary { padding: 12px; font-size: 16px; margin-top: 4px; }
#gateForm .hint { color: var(--ink-3, #666); margin-top: -4px; }
.gate-err { color: #c62828; min-height: 1.2em; font-size: 14px; }
@media (max-width: 420px) { #gateForm .fgrid { grid-template-columns: 1fr; } }
body.mode-client #btnEdit, body.mode-client #btnClients, body.mode-client #btnSettings,
body.mode-client #btnBrochure, body.mode-client #btnAddProduct, body.mode-client .edit-only { display: none !important; }
body.mode-client .c-price input.custom { border-color: transparent; background: transparent; pointer-events: none; }
.req-comment { display: grid; gap: 4px; margin: 8px 0; }
.req-comment textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 8px; font: inherit; resize: vertical; }
.st.ost-new { background: #fff3cd; color: #8a6100; } .st.ost-seen { background: #e3f2fd; color: #0d47a1; }
.st.ost-quoted { background: #ede7f6; color: #4527a0; } .st.ost-done { background: #e8f5e9; color: #1b5e20; } .st.ost-rejected { background: #fdecea; color: #b71c1c; }
.saved-item.jr.is-new { border-inline-start: 3px solid var(--brand); }
.st-sel { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line, #ddd); font: inherit; }
