/* ============================================================
   مدیریت انبار و سفارش — استایل موبایل‌محور، راست‌چین، سریع
   ============================================================ */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../vendor/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../vendor/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../vendor/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #5a6a80;
  --line: #e3e8ef;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --indigo: #4338ca;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 26px -14px rgba(15, 23, 42, .18);
  --topbar-h: 58px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

#app {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* ---------- نوار بالا ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 55%, #4338ca 130%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .18);
}
#topbar-title {
  flex: 1;
  font-size: 16.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn:active { background: rgba(255, 255, 255, .3); }
/* ---------- صفحه‌ها ---------- */
.screen { display: none; padding: 14px 14px calc(110px + env(safe-area-inset-bottom)); }
.screen.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- صفحه اصلی ---------- */
.home-search { margin-bottom: 12px; }
.home-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-num { font-size: 17px; font-weight: 700; color: var(--brand-dark); }
.stat-card .stat-label { font-size: 11px; color: var(--muted); }

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.home-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: right;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  min-height: 116px;
  transition: transform .08s ease;
}
.home-card:active { transform: scale(.97); }
.hc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin-bottom: 8px;
}
.i-teal { background: var(--brand-soft); color: var(--brand-dark); }
.i-indigo { background: #e0e7ff; color: var(--indigo); }
.i-amber { background: var(--amber-soft); color: var(--amber); }
.i-rose { background: var(--danger-soft); color: var(--danger); }
.i-sky { background: #e0f2fe; color: #0369a1; }
.i-emerald { background: #d1fae5; color: #059669; }
.wv-reorder { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }
.wv-reorder-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.wv-reorder-btn:active { background: var(--brand-soft); border-color: var(--brand); }
.wv-reorder-btn:disabled { opacity: .3; cursor: default; }
.i-slate { background: #e2e8f0; color: #334155; }
.hc-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.hc-sub { font-size: 11.5px; color: var(--muted); }

.home-foot { text-align: center; color: #94a3b8; font-size: 12px; margin-top: 22px; }

/* ---------- جستجو ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 4px 12px;
  box-shadow: var(--shadow);
  color: var(--muted);
}
.search-box:focus-within { border-color: var(--brand); color: var(--brand-dark); }
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15.5px;
  color: var(--ink);
  padding: 10px 0;
  min-width: 0;
}
.search-box input::placeholder { color: #94a3b8; }

/* ---------- چیپ انبار ---------- */
.chip-row { display: flex; gap: 8px; margin: 12px 0 6px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.result-count { color: var(--muted); font-size: 12.5px; margin: 6px 2px 8px; }

/* ---------- جدول محصولات ---------- */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.prod-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.prod-table thead th:first-child { border-top-right-radius: var(--radius); }
.prod-table thead th:last-child { border-top-left-radius: var(--radius); }
.prod-table tbody tr:last-child td:first-child { border-bottom-right-radius: var(--radius); }
.prod-table tbody tr:last-child td:last-child { border-bottom-left-radius: var(--radius); }
.prod-table thead th {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 30;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 9px 6px;
  text-align: right;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
.prod-table tbody td {
  padding: 10px 6px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prod-table tbody td.col-code, .prod-table tbody td.col-stock, .prod-table tbody td.col-price {
  padding-top: 12px;
}
.prod-table tbody tr:last-child td { border-bottom: none; }
.prod-table tbody tr:active { background: #f8fafc; }
.col-code { width: 17%; }
.col-name { width: 38%; }
.col-stock { width: 12%; }
.col-price { width: 23%; }
.col-add { width: 10%; text-align: center !important; }
.wh-badge {
  display: inline-block;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 2px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 500;
}
.wh-badge.wh2 { background: #e0e7ff; color: var(--indigo); }
.jor-badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 700;
  margin-inline-start: 4px;
  border: 1px solid #c4b5fd;
}
.price-null { color: #94a3b8; font-weight: 400; }

/* ---------- حالت خالی ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-icon { font-size: 42px; margin-bottom: 8px; }
.empty-state p { font-size: 15px; font-weight: 500; }
.empty-sub { font-size: 12.5px; color: #94a3b8; }

/* ---------- سبد سفارش ---------- */
.cart-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.ci-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ci-name { font-weight: 700; font-size: 14px; }
.ci-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.ci-remove {
  border: none; background: var(--danger-soft); color: var(--danger);
  width: 44px; height: 44px; border-radius: 10px; font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.ci-body { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.qty-stepper { display: inline-flex; align-items: center; gap: 2px; background: #f1f5f9; border-radius: 12px; padding: 3px; }
.qty-btn {
  width: 44px; height: 44px; border: none; background: transparent; border-radius: 10px;
  font-size: 20px; font-weight: 700; color: var(--ink); cursor: pointer; font-family: inherit;
}
.qty-btn:active { background: var(--line); }
.qty-val { min-width: 44px; text-align: center; font-weight: 700; font-size: 15px; }
.ci-price { text-align: left; }
.ci-price .unit { color: var(--muted); font-size: 11px; }
.ci-price .line { font-weight: 700; font-size: 14px; color: var(--brand-dark); }
.ci-warn {
  margin-top: 8px;
  background: var(--amber-soft);
  color: #92400e;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
}
.ci-warn.danger { background: var(--danger-soft); color: var(--danger); }

.order-summary {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin: 14px 0;
}
.os-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); font-size: 13.5px; }
.os-row strong { color: var(--ink); }
.os-total { border-top: 1.5px dashed var(--line); margin-top: 6px; padding-top: 10px; }
.os-total span { font-weight: 700; color: var(--ink); }
.os-total strong { color: var(--brand-dark); font-size: 19px; }

.order-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  padding: 13px 18px;
  min-height: 50px;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: linear-gradient(135deg, #0d9488, #0f766e); color: #fff; box-shadow: 0 8px 20px -8px rgba(13, 148, 136, .6); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { width: 100%; }
.btn-sm { min-height: 40px; padding: 9px 14px; font-size: 13.5px; border-radius: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 120px; }

/* ---------- کارت‌های فایل ---------- */
.file-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  border-right: 5px solid var(--brand);
}
.file-card.wh2 { border-right-color: var(--indigo); }
.fc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fc-title { font-weight: 700; font-size: 15px; }
.fc-file {
  background: #f8fafc;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 13px;
}
.fc-file .fn { font-weight: 700; word-break: break-all; }
.fc-file .fm { color: var(--muted); font-size: 12px; margin-top: 3px; }
.fc-actions { display: flex; gap: 8px; margin-top: 10px; }
.fc-actions .btn { flex: 1; }

.info-note {
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-top: 10px;
  line-height: 1.9;
}

/* ---------- ویزارد وارد کردن ---------- */
.imp-step { margin-bottom: 12px; }
.imp-label { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.wh-select-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wh-select {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}
.wh-select .w-title { font-weight: 700; font-size: 15px; }
.wh-select.selected { border-color: var(--brand); background: var(--brand-soft); }

.drop-zone {
  border: 2px dashed #cbd5e1;
  background: var(--card);
  border-radius: var(--radius);
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.drop-zone:active { background: #f8fafc; }
.drop-zone .dz-icon { font-size: 40px; margin-bottom: 6px; }
.drop-zone .dz-title { font-weight: 700; color: var(--ink); font-size: 15px; }
.drop-zone .dz-sub { font-size: 12px; margin-top: 4px; }

.progress-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 16px; text-align: center; }
.progress-bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, #0d9488, #4338ca); border-radius: 999px; transition: width .2s ease; }
.progress-text { color: var(--muted); font-size: 13px; min-height: 22px; }

.preview-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.pv-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.pv-row:last-child { border-bottom: none; }
.pv-row .lbl { color: var(--muted); }
.pv-row .val { font-weight: 700; }
.pv-table-wrap { max-height: 280px; overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.pv-table th, .pv-table td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.pv-table th { background: #f8fafc; color: var(--muted); font-weight: 500; position: sticky; top: 0; }
.warn-list { margin-top: 10px; }
.warn-item {
  background: var(--amber-soft); color: #92400e; border-radius: 10px;
  padding: 8px 10px; font-size: 12px; margin-bottom: 6px;
}

.unit-radio { display: flex; gap: 8px; }
.unit-radio label {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px;
  cursor: pointer; font-size: 13.5px; font-weight: 500; background: var(--card);
}
.unit-radio input { accent-color: var(--brand); }
.unit-radio label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- لیست سفارش‌ها ---------- */
.order-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}
.order-card:active { background: #f8fafc; }
.oc-no {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.oc-body { flex: 1; min-width: 0; }
.oc-title { font-weight: 700; font-size: 14px; }
.oc-sub { color: var(--muted); font-size: 12px; }
.oc-total { text-align: left; }
.oc-total .t { font-weight: 700; color: var(--brand-dark); font-size: 14px; }
.oc-total .d { font-size: 11px; color: var(--muted); }

/* ---------- جزئیات سفارش ---------- */
.od-hero {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 10px 26px -12px rgba(13, 148, 136, .55);
}
.od-hero .oh-no { font-size: 22px; font-weight: 700; }
.od-hero .oh-date { opacity: .85; font-size: 13px; margin-top: 2px; }
.od-hero .oh-total { margin-top: 10px; font-size: 17px; font-weight: 700; }
.od-table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.od-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.od-table th { background: #f8fafc; color: var(--muted); font-weight: 500; padding: 9px 8px; text-align: right; border-bottom: 1.5px solid var(--line); font-size: 11px; }
.od-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.od-table tr:last-child td { border-bottom: none; }

/* ---------- تنظیمات ---------- */
.set-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.set-title { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; color: var(--brand-dark); }
.set-row { margin-bottom: 12px; }
.set-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.set-row input[type="text"], .set-row input[type="date"], .set-row select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  background: var(--card);
  color: var(--ink);
}
.set-row input:focus { border-color: var(--brand); }
.about-line { font-size: 13px; color: var(--muted); text-align: center; margin-top: 16px; }

/* ---------- راهنما ---------- */
.help-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.help-card h3 { color: var(--brand-dark); margin-bottom: 10px; }
.help-list { padding-right: 20px; }
.help-list li { margin-bottom: 10px; font-size: 13.5px; line-height: 1.9; }

/* ---------- دکمه شناور سبد ---------- */
.cart-fab {
  position: fixed;
  left: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 60px; height: 60px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(135deg, #4338ca, #0d9488);
  color: #fff;
  box-shadow: 0 12px 28px -8px rgba(67, 56, 202, .55);
  cursor: pointer;
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.cart-fab[hidden] { display: none; }
.cart-fab:active { transform: scale(.94); }
.fab-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  min-width: 22px; height: 22px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}
.fab-total {
  position: absolute;
  bottom: 68px;
  left: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #4338ca, #0d9488);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .2px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .35);
  box-shadow: 0 8px 20px -6px rgba(67, 56, 202, .6);
}
.fab-total::before { content: '💰'; font-size: 12px; }

/* ---------- دیالوگ و شیت ---------- */
.overlay {
  position: fixed; top: 0; left: 0; right: 0;
  height: calc(var(--app-vvh, 100vh));
  background: rgba(15, 23, 42, .45);
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .15s ease;
}
.overlay.center { align-items: center; padding: 24px; }
.sheet {
  background: var(--card);
  width: 100%;
  max-width: 500px;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: min(88vh, calc(var(--app-vvh, 100vh) - 24px));
  overflow: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 0 auto 14px; }
.sheet-title { font-weight: 700; font-size: 16px; margin-bottom: 12px; text-align: center; }

.dialog {
  background: var(--card);
  width: 100%;
  max-width: 400px;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .4);
  animation: popIn .16s ease;
}
@keyframes popIn { from { transform: scale(.94); opacity: .6; } to { transform: none; opacity: 1; } }
.dialog-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.dialog-msg { font-size: 14px; color: var(--muted); line-height: 1.9; }
.dialog-btns { display: flex; gap: 10px; margin-top: 16px; }
.dialog-btns .btn { flex: 1; min-height: 46px; }

/* ---------- توست ---------- */
#toast-root { position: fixed; top: calc(var(--topbar-h) + 10px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 120; pointer-events: none; }
.toast {
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, .5);
  animation: slideDown .18s ease;
  max-width: 90vw;
  text-align: center;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- شیت تعداد ---------- */
.qty-sheet-num {
  width: 100%;
  text-align: center;
  font-size: 40px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-bottom: 2.5px solid var(--brand);
  outline: none;
  padding: 8px 0;
  margin-bottom: 12px;
  background: transparent;
}
.qty-sheet-info { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.qty-sheet-info b { color: var(--ink); }

/* ---------- خروجی PDF ---------- */
#print-area { position: absolute; left: -10000px; top: 0; width: 720px; background: #fff; }
.pdf-order { font-family: 'Vazirmatn', sans-serif; direction: rtl; padding: 28px; color: #0f172a; background: #fff; }
.pdf-head { text-align: center; border-bottom: 3px solid #0d9488; padding-bottom: 14px; margin-bottom: 16px; }
.pdf-brand { color: #0d9488; font-weight: 700; font-size: 14px; }
.pdf-head h2 { font-size: 22px; margin: 4px 0; }
.pdf-date { color: #64748b; font-size: 13px; }
.pdf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pdf-table th { background: #0f766e; color: #fff; padding: 8px; text-align: right; }
.pdf-table th:first-child { border-radius: 0 10px 10px 0; }
.pdf-table th:last-child { border-radius: 10px 0 0 10px; }
.pdf-table td { padding: 7px 8px; border-bottom: 1px solid #e2e8f0; }
.pdf-total {
  margin-top: 16px;
  background: #f0fdfa;
  border: 1.5px solid #0d9488;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 15px;
}
.pdf-total strong { color: #0f766e; font-size: 18px; }
.pdf-rial { font-size: 9px; color: var(--muted); margin-top: 1px; }
.pdf-rial-total { text-align: left; }
.pdf-foot { margin-top: 18px; color: #94a3b8; font-size: 11.5px; text-align: left; }

/* اسکرول‌بار ظریف */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   افزونه نسخه ۱٫۱ — آرشیو داروخانه‌ها، ویرایش سفارش، جستجوی اینترنتی
   (به استایل‌های موجود دست نزده شده؛ فقط اضافه شده)
   ============================================================ */

/* کارت وسیع صفحه اصلی (آرشیو) */
.home-card-wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; min-height: 82px; }
.home-card-wide .hc-icon { margin-bottom: 0; flex-shrink: 0; }
.hc-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.i-violet { background: #ede9fe; color: #7c3aed; }

/* فرم اطلاعات سفارش */
.set-row input[type="tel"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  background: var(--card);
  direction: rtl;
}
.set-row input[type="tel"]:focus { border-color: var(--brand); }
.set-row textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  resize: vertical;
  background: var(--card);
}
.set-row textarea:focus { border-color: var(--brand); }

/* اطلاعات سفارش در جزئیات */
.od-info { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; }
.od-info-row { display: flex; gap: 8px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.od-info-row:last-child { border-bottom: none; }
.od-info-row .lbl { color: var(--muted); min-width: 76px; font-weight: 500; flex-shrink: 0; }
.od-info-row .val { font-weight: 600; word-break: break-word; }

/* آرشیو داروخانه‌ها */
.arch-group-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #4338ca;
  margin: 16px 2px 8px;
}
.arch-group-title:first-child { margin-top: 4px; }
.ph-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  border-right: 5px solid #7c3aed;
}
.ph-card:active { background: #f8fafc; }
.ph-card.ph-null { border-right-color: #94a3b8; }
.ph-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ph-name { font-weight: 700; font-size: 15px; }
.ph-count { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; white-space: nowrap; }
.ph-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; word-break: break-word; }

/* پرونده داروخانه */
.ph-hero {
  background: linear-gradient(135deg, #7c3aed, #4338ca);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 10px 26px -12px rgba(124, 58, 237, .5);
}
.ph-hero .phh-name { font-size: 19px; font-weight: 700; }
.ph-hero .phh-sub { opacity: .92; font-size: 12.5px; margin-top: 3px; word-break: break-word; }
.ph-hero .phh-stats { display: flex; gap: 14px; margin-top: 10px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }

/* دکمه ویرایش روی کارت سفارش */
.oc-edit {
  border: none;
  background: var(--brand-soft);
  color: var(--brand-dark);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.oc-edit:active { background: var(--brand); color: #fff; }

/* اطلاعات PDF */
.pdf-info { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.pdf-info-row { font-size: 12.5px; padding: 2px 0; display: flex; gap: 6px; }
.pdf-info-row span { color: #64748b; min-width: 60px; }

/* ============================================================
   افزونه پک‌های ذخیره‌شده — نسخه ۱٫۲
   ============================================================ */
.pack-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.pack-item:last-child { border-bottom: none; }
.pack-info { flex: 1; min-width: 0; }
.pack-name { font-weight: 700; font-size: 14px; }
.pack-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

/* (دکمه/ستون «پک» قدیمی حذف شد؛ جایگزین با برچسب «بسته» شد) */

/* ============================================================
   افزونه آفر هر قلم (کنار تعداد) — اطلاعات مستقل، بدون تأثیر روی مبلغ
   ============================================================ */
.ci-offer-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ci-offer-label { color: var(--muted); font-size: 12.5px; font-weight: 600; min-width: 34px; flex-shrink: 0; }
.ci-offer-input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  min-width: 0;
}
.ci-offer-input:focus { border-color: var(--brand); background: #fff; }
/* ============================================================
   سیستم حساب کاربری — صفحه ورود و دکمه کاربر
   ============================================================ */
.login-screen[hidden] { display: none; }
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(160deg, #0d9488 0%, #0f766e 40%, #4338ca 120%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}
.login-card {
  background: #fff;
  border-radius: 22px;
  padding: 26px 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .45);
}
.login-logo { font-size: 42px; text-align: center; }
.login-title { text-align: center; font-size: 19px; font-weight: 700; margin: 6px 0 2px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.login-status { border-radius: 10px; padding: 8px 10px; font-size: 12.5px; margin: 8px 0; }
.login-status.error { background: var(--danger-soft); color: var(--danger); }
.login-status.ok { background: var(--ok-soft); color: var(--ok); }
.topbar-user {
  background: rgba(255, 255, 255, .16);
  border: none;
  color: #fff;
  border-radius: 12px;
  height: 38px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user:active { background: rgba(255, 255, 255, .3); }

/* حلقه فوکوس واضح برای ناوبری با صفحه‌کلید (UX-M4) — روی تمام
   input/textarea/select/button؛ با :focus-visible فقط برای فوکوس
   کیبوردی فعال می‌شود، ظاهر لمسی/موسی تغییری نمی‌کند. */
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.4);
  outline: none;
}


/* برنامه هفتگی ویزیت: کارت‌های کوچک‌تر برای چک سریع در طول روز */
#wv-list .order-card { padding: 9px 10px; gap: 8px; margin-bottom: 7px; }
#wv-list .oc-title { font-size: 13px; }
#wv-list .oc-sub { font-size: 11px; }
#wv-list .wv-handle,
#wv-list .wv-reorder-btn { width: 26px; height: 26px; font-size: 13px; }
#wv-list .wv-reorder-btn { font-size: 11px; }
#wv-list .wv-actions { gap: 4px; }
#wv-list .wv-del { height: 22px; font-size: 13px; }
#wv-list .wv-done-btn { min-height: 30px; padding: 4px 10px; font-size: 11.5px; border-radius: 9px; white-space: nowrap; }

/* ===== برنامه هفتگی ویزیت: شماره، دستگیره‌ی دراگ، حذف ===== */
.wv-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; margin-inline-end: 6px;
  border-radius: 11px; background: var(--brand-soft); color: var(--brand-dark);
  font-size: 12px; font-weight: 700;
}
.wv-handle {
  width: 32px; height: 32px;
  border: 1.5px dashed var(--line); border-radius: 8px;
  background: var(--card); color: var(--muted);
  font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.wv-handle:active { cursor: grabbing; background: var(--brand-soft); border-color: var(--brand); }
.wv-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex-shrink: 0; }
.wv-del {
  border: none; background: #fef2f2; color: var(--danger);
  border-radius: 8px; height: 28px; font-size: 15px; cursor: pointer;
}
.wv-del:active { background: var(--danger); color: #fff; }
.order-card.wv-dragging {
  position: relative; z-index: 5; opacity: .95;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .25);
}
.order-card.wv-drop-before { box-shadow: var(--shadow), 0 -4px 0 var(--brand); }
.order-card.wv-drop-after { box-shadow: var(--shadow), 0 4px 0 var(--brand); }

/* گروه (زیرشاخه‌ها) در برنامه ویزیت: چند مورد پشت‌سرهم با منطقه/خیابان یکسان */
.wv-group {
  margin-bottom: 12px;
  border: 1.5px solid var(--brand-soft);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(0, 0, 0, .015);
  padding: 8px 8px 0;
}
.wv-group-head {
  font-weight: 700; font-size: 12.5px; color: var(--brand-dark);
  padding: 2px 6px 6px;
}
.wv-group .order-card { margin-inline-start: 8px; }


/* ============================================================
   صفحه‌ی جستجوی محصولات: جدول با هدر ستونی، ردیف‌های فشرده و جداشده
   (فقط همین صفحه؛ بقیه‌ی اپ بدون تغییر)
   ============================================================ */
#prod-count { display: flex; justify-content: space-between; align-items: center; }
#prod-count:not(:empty)::after { content: 'قیمت‌ها به تومان'; }

.prod-table, .prod-table tbody { display: block; width: 100%; }
.prod-table thead {
  display: block;
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 30;
  background: #f0fdfa;
  border-bottom: 2px solid #5eead4;
  border-radius: var(--radius) var(--radius) 0 0;
}
.prod-table thead tr, .prod-table tbody td.pc-cell {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 40px 58px 70px;
  column-gap: 4px;
}
.prod-table thead tr { padding: 11px 8px; align-items: center; }
.prod-table thead th {
  position: static; display: block; padding: 0; border: none; background: none;
  color: var(--brand-dark); font-size: 12px; font-weight: 700; text-align: right; white-space: nowrap;
}
.prod-table thead th.col-stock, .prod-table thead th.col-price { text-align: center; }
.prod-table tbody tr.pc-row { display: block; }
.prod-table tbody td.pc-cell {
  align-items: start;
  padding: 10px 8px;
  white-space: normal; overflow: visible; text-overflow: clip;
  border-bottom: 1.5px solid #cbd5e1;
}
.prod-table tbody tr.pc-row:last-child td.pc-cell { border-bottom: none; }
.table-wrap { border: 1px solid #cbd5e1; }

.pc-codecol { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.pc-code { direction: ltr; unicode-bidi: embed; color: var(--muted); font-size: 12px; }
.pc-codecol .wh-badge { margin-top: 0; font-size: 11px; padding: 2px 8px; white-space: nowrap; }
.pc-main { min-width: 0; }
.pc-name { font-size: 13px; font-weight: 600; line-height: 1.55; white-space: normal; word-break: break-word; color: var(--ink); }
.pc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; }
.pc-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; font-size: 11px; height: 26px; padding: 0 8px;
  border-radius: 8px; border: none; cursor: pointer; white-space: nowrap; background: transparent;
}
.pc-alias { background: var(--amber-soft); color: #92400e; }
.pc-pack { background: #e0e7ff; color: #3730a3; }
.pc-ico { width: 30px; padding: 0; justify-content: center; border: 1px dashed #cbd5e1; color: #9ca3af; font-size: 13px; }
.pc-ico:active { border-color: var(--brand); }
.pc-num { font-size: 13px; font-weight: 700; text-align: center; padding-top: 2px; color: #111827; }
.pc-stock-low { color: #d97706; }
.pc-stock-na { color: var(--muted); font-weight: 500; }
.pc-actions { display: flex; align-items: center; gap: 4px; }
.pc-jor { position: relative; flex: none; width: 30px; height: 42px; cursor: pointer; }
.pc-jor input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.pc-jor span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 10px; border: 1px solid #e5e7eb; background: #fff;
  font-size: 15px; filter: grayscale(1); opacity: .6;
}
.pc-jor input:checked + span { background: var(--amber-soft); border-color: #fcd34d; filter: none; opacity: 1; }
.pc-add {
  flex: none; width: 34px; height: 42px; border-radius: 12px; border: none;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 20px; font-weight: 600; cursor: pointer; font-family: inherit; padding: 0;
}
.pc-add:active { background: var(--brand); color: #fff; }


/* ============================================================
   داروخانه‌های هدف: لیست فشرده‌ی خیابان‌ها (یک کارت، ردیف‌های کم‌ارتفاع)
   (داروخانه‌های هدف + آرشیو)
   ============================================================ */
.acc-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 8px; font-size: 12px; color: var(--muted); }
.acc-all { border: none; background: transparent; color: var(--brand-dark); font-family: inherit; font-size: 12px; font-weight: 600; padding: 4px 6px; cursor: pointer; }
#tp-list .acc-card,
#arch-list .acc-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 10px; }
#tp-list .acc-title,
#arch-list .acc-title {
  margin: 0; padding: 0 14px; min-height: 46px;
  border-top: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--ink);
}
#tp-list .acc-title > span:first-child,
#arch-list .acc-title > span:first-child { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
#tp-list .acc-ico,
#arch-list .acc-ico { font-size: 15px; }
#tp-list .acc-name,
#arch-list .acc-name { flex: 1; min-width: 0; }
#tp-list .acc-count,
#arch-list .acc-count {
  min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
#tp-list .acc-due,
#arch-list .acc-due { font-size: 13px; }
#tp-list .acc-arrow,
#arch-list .acc-arrow { color: var(--muted); font-size: 13px; }
#tp-list .acc-body,
#arch-list .acc-body { padding: 8px 10px 2px; background: var(--bg); border-top: 1px solid var(--line); }


/* ============================================================
   برنامه هفتگی ویزیت: نوار هفت‌روزه‌ی ثابت (بدون اسکرول افقی)
   ============================================================ */
.wv-strip {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--card); border-radius: 12px; padding: 2px;
  box-shadow: var(--shadow); overflow: visible;
}
.wv-day {
  border: none; background: transparent; height: 36px; padding: 0; min-width: 0;
  border-radius: 10px; cursor: pointer; font-family: inherit; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.wv-l { font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: -0.2px; line-height: 1; }
.wv-dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wv-day.has .wv-dot { background: var(--brand); }
.wv-day.today .wv-l { color: #e11d48; }
.wv-day.active { background: var(--brand); color: #fff; }
.wv-day.active .wv-l { color: #fff; }
.wv-day.active.has .wv-dot { background: #fff; }

/* ============================================================
   برنامه هفتگی ویزیت (نسخه فشرده): نوار هفته‌ها، ردیف یک‌خطی، گروه با دستگیره، انتخاب چندتایی
   ============================================================ */
.wv-weekbar { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }
.wv-seg { flex: 1; display: flex; background: var(--card); border-radius: 11px; padding: 3px; box-shadow: var(--shadow); }
.wv-seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; height: 28px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; padding: 0; }
.wv-seg button.act { background: var(--brand); color: #fff; }
.wv-seg button.today::after { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-inline-start: 4px; vertical-align: middle; }
.wv-range { font-size: 11px; color: var(--muted); white-space: nowrap; }
.wv-tools { display: flex; gap: 6px; margin: 8px 0; }
.wv-tools .btn { flex: 1; min-height: 38px; padding: 6px 2px; font-size: 12px; white-space: nowrap; }
.wv-selbar { display: flex; align-items: center; gap: 8px; background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; padding: 6px 8px; margin: 8px 0; font-size: 13px; }
.wv-selbar[hidden], .wv-bottombar[hidden], .wv-tools[hidden] { display: none; }
.wv-selbar .btn { min-height: 32px; padding: 4px 8px; font-size: 12px; white-space: nowrap; }
#wv-sel-count { margin-inline-end: auto; }
.wv-bottombar { position: sticky; bottom: 8px; display: flex; gap: 6px; background: var(--card); border-radius: 14px; padding: 8px; box-shadow: 0 -4px 18px rgba(0,0,0,.14); margin-top: 10px; z-index: 4; }
.wv-bottombar .btn { flex: 1; min-height: 38px; padding: 6px 4px; font-size: 12px; white-space: nowrap; }

#wv-list { min-height: 40px; }
.wv-row { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 12px; padding: 6px 8px; margin-bottom: 6px; box-shadow: var(--shadow); position: relative; }
.wv-row.done { opacity: .55; }
.wv-row.sel { background: var(--brand-soft); }
.wv-row .wv-handle { width: 22px; height: 30px; border: none; background: transparent; font-size: 15px; color: var(--muted); flex: none; }
.wv-row .wv-num { min-width: 20px; height: 20px; padding: 0 5px; margin-inline-end: 0; font-size: 11px; flex: none; }
.wv-main { flex: 1; min-width: 0; cursor: pointer; }
.wv-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.wv-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-pill { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; flex: none; }
.wv-acts { display: flex; gap: 4px; flex: none; }
.wv-acts button { width: 30px; height: 30px; border-radius: 9px; border: none; font-size: 14px; font-weight: 700; cursor: pointer; padding: 0; }
.wv-acts .wv-ok { background: var(--brand); color: #fff; }
.wv-acts .wv-undo { background: #eef1f5; color: #64748b; }
.wv-acts .wv-x { background: #fef2f2; color: var(--danger); }
.wv-chk { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; flex: none; }
.wv-chk.on { background: var(--brand); border-color: var(--brand); }
.wv-group { background: var(--card); border: 0; padding: 0; margin-bottom: 8px; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.wv-group-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 12.5px; }
.wv-group-head i { font-style: normal; font-weight: 500; font-size: 11px; color: var(--muted); margin-inline-start: auto; }
.wv-group-head[data-wv-pickgroup] { cursor: pointer; }
.wv-ghandle { font-size: 17px; color: var(--brand-dark); width: 18px; text-align: center; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.wv-group .wv-row { margin: 0; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line); }
.wv-row.wv-dragging, .wv-group.wv-dragging { position: relative; z-index: 5; opacity: .95; box-shadow: 0 10px 26px rgba(0,0,0,.25); }
.wv-row.wv-drop-before, .wv-group.wv-drop-before { box-shadow: var(--shadow), 0 -4px 0 var(--brand); }
.wv-row.wv-drop-after, .wv-group.wv-drop-after { box-shadow: var(--shadow), 0 4px 0 var(--brand); }

.wv-wk-row { display: flex; gap: 6px; }
.wv-wk { flex: 1; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); font: inherit; font-weight: 700; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; padding: 0; }
.wv-wk.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.wv-wk-quick { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wv-wk-quick button { border: 0; border-radius: 999px; background: #eef1f5; color: var(--muted); font: inherit; font-size: 11.5px; padding: 5px 10px; cursor: pointer; }
.wv-wk-off { opacity: .45; pointer-events: none; }

/* hidden باید روی دکمه‌های .btn هم کار کند (کلاس .btn display دارد) */
#btn-wv-clear-day[hidden], #wv-selbar[hidden], #wv-bottombar[hidden], #wv-tools[hidden] { display: none !important; }

/* ===== استعلام (شخصی): سطر زیر نام داروخانه روی برنامه هفتگی + بخش استعلام ===== */
.wv-est-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.wv-est { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.wv-est.good { background: #dcfce7; color: #166534; }
.wv-est.bad { background: #fee2e2; color: #991b1b; }
.wv-est.none { background: #eef1f5; color: var(--muted); }
.wv-est-row .wv-est { cursor: pointer; }
.wv-est-b { width: 30px; height: 24px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; padding: 0; line-height: 1; }
.wv-est-b:active { background: var(--brand-soft); }
.est-pick { flex: 1; height: 42px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--ink); }
.est-pick.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.est-item { background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--brand); }
.est-item.bad { border-inline-start-color: var(--danger); }
.est-head { font-size: 13px; }
.est-name { font-weight: 700; }
.est-note { font-size: 12.5px; margin-top: 4px; color: var(--ink); white-space: pre-wrap; }
.est-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.est-del { margin-top: 6px; border: none; background: #fef2f2; color: var(--danger); border-radius: 8px; height: 28px; padding: 0 10px; font: inherit; font-size: 12px; cursor: pointer; }
/* ===== نسخه‌ی جدید: رنگ استعلام، گروه‌های خیابان قابل باز/بسته ===== */
.wv-est-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.wv-est-b { width: 32px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; padding: 0; line-height: 1; }
.wv-est-b.on-good { background: #16a34a; border-color: #16a34a; color: #fff; }
.wv-est-b.on-bad { background: #dc2626; border-color: #dc2626; color: #fff; }
.wv-est-note { border: none; background: transparent; color: var(--brand-dark); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.wv-est-dot { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 22px; border-radius: 7px; font-size: 12px; color: #fff; }
.wv-est-dot.good { background: #16a34a; }
.wv-est-dot.bad { background: #dc2626; }
.wv-row.est-good { border-left: 4px solid #16a34a; }
.wv-row.est-bad { border-left: 4px solid #dc2626; }
.wv-group .wv-row.est-good { border-left: 4px solid #16a34a; }
.wv-group .wv-row.est-bad { border-left: 4px solid #dc2626; }
.wv-group-head { cursor: pointer; user-select: none; }
.wv-group-head i { margin-inline-start: auto; }
.wv-chev { font-size: 14px; color: var(--brand-dark); width: 14px; text-align: center; }
.wv-group.collapsed .wv-row { height: 0 !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; overflow: hidden; opacity: 0; box-shadow: none; }
.wv-group.collapsed .wv-group-head { border-bottom: 0; }
.wv-listbar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
#wv-listbar[hidden] { display: none !important; }
.wv-listbar .btn { min-height: 32px; padding: 4px 10px; font-size: 12px; }

/* ===== بخش استعلام (شخصی) — طرح تأییدشده ===== */
.est-group { background: var(--card); border-radius: 12px; margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden; }
.est-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #fff; color: #334155; font-weight: 700; font-size: 13px; cursor: pointer; user-select: none; border-bottom: 2px solid #e2e8f0; }
.est-group-head i { font-style: normal; font-weight: 500; font-size: 11px; color: var(--muted); margin-inline-start: auto; }
.est-group.collapsed .est-group-body { display: none; }
.est-row { padding: 10px 12px; border-top: 1px solid #eef1f5; border-inline-start: 5px solid transparent; background: #fff; }
.est-row.good { border-inline-start-color: #16a34a; }
.est-row.hard { border-inline-start-color: #f59e0b; }
.est-row.bad { border-inline-start-color: #dc2626; }
.est-row-top { display: flex; align-items: center; gap: 8px; }
.est-pname { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est-btns { display: flex; gap: 6px; flex: none; }
.est-pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 8px; border-radius: 999px; border: 1.5px solid #cbd5e1; background: #fff; color: #64748b; font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; white-space: nowrap; }
.est-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e2e8f0; flex: none; }
.est-dot-x { font-weight: 900; font-size: 13px; color: #94a3b8; line-height: 1; }
.est-pill.good.on { background: #16a34a; border-color: #16a34a; color: #fff; }
.est-pill.hard.on { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.est-pill.bad.on { background: #dc2626; border-color: #dc2626; color: #fff; }
.est-pill.on .est-dot { background: rgba(255,255,255,.25); }
.est-pill.hard.on .est-dot-x { color: #fff; }
.est-row-bot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.est-lastnote { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 0; }
.est-note-bad { color: #dc2626; font-weight: 700; background: #fef2f2; border-radius: 8px; padding: 4px 8px; }
.est-note-hard { color: #b45309; font-weight: 700; background: #fffbeb; border-radius: 8px; padding: 4px 8px; }
.est-link { border: none; background: transparent; color: #0b6b62; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 4px; }
.est-hist { margin-top: 8px; display: grid; gap: 6px; }
.est-hitem { background: #f6f8fa; border-radius: 10px; padding: 7px 9px; border-inline-start: 3px solid transparent; }
.est-hitem.good { border-inline-start-color: #16a34a; }
.est-hitem.hard { border-inline-start-color: #f59e0b; }
.est-hitem.bad { border-inline-start-color: #dc2626; }
.est-hhead { font-size: 12px; font-weight: 700; }
.est-hnote { font-size: 12px; margin-top: 3px; white-space: pre-wrap; }
.est-hitem .est-del { margin-top: 5px; }
.est-pick { flex: 1; height: 42px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); font: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer; color: var(--ink); padding: 0 4px; }
.est-pick.on { background: var(--brand); border-color: var(--brand); color: #fff; }
/* هدر گروه‌های برنامه هفتگی هم سفید (همان طرح) */
.wv-group-head { background: #fff !important; color: #334155 !important; border-bottom: 2px solid #e2e8f0; }
/* متن یادداشت زیر نام داروخانه: قرمز (همه‌ی وضعیت‌ها) */
.est-lastnote, .est-lastnote.est-note-bad, .est-lastnote.est-note-hard { color: #e11d48; font-weight: 700; background: none; padding: 4px 0; }
.est-link-del { color: #dc2626; margin-inline-start: auto; }


/* ===== پیشنهادهای هوشمند نام محصول (SmartNames) — افزایشی ===== */
.pc-suggest-head .pc-cell { font-size: 12.5px; color: var(--muted); background: transparent; padding-top: 12px; border-bottom: 1px dashed var(--border, #d1d5db); }
.pc-suggest-row .pc-name { opacity: .95; }
.pc-suggest-tag { background: #eef2ff; color: #3730a3; }
.pc-suggest-weak { background: #fef3c7; color: #92400e; }

/* ===== مدیریت اسم‌های پیشنهادی — افزایشی ===== */
.sn-row { margin-bottom: 8px; padding: 10px 12px; }
.sn-row:active { opacity: .85; }

/* ===== ثبت گروهی اسم‌های پیشنهادی ===== */
.sn-bar { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sn-row.sn-selected { outline: 2px solid #059669; background: #ecfdf5; }
.sn-check { margin-inline-end: 6px; }

/* ===== نوار برند و دسته (صفحه محصولات) — افزایشی ===== */
.tag-card { background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 8px 10px 6px; margin-bottom: 8px; }
.tag-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.tag-actions { display: flex; gap: 6px; }
.tag-ib { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border, #d1d5db); background: #fff; color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; padding: 0; }
.tag-ib-sm { width: 24px; height: 24px; font-size: 12px; }
.tag-bar-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 118px; overflow-y: auto; padding: 6px 0 3px; -webkit-overflow-scrolling: touch; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; white-space: nowrap; border: 1px solid var(--border, #d1d5db); background: #fff; border-radius: 999px; font: inherit; font-size: 12.5px; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.tag-chip small { font-size: 10.5px; color: var(--muted); }
.tag-chip.active { background: #0f766e; border-color: #0f766e; color: #fff; }
.tag-chip.active small { color: #99f6e4; }
.tag-sub { margin: 4px 10px 2px 0; padding: 2px 10px 0 0; border-right: 2px solid #14b8a6; }
.tag-sub .tag-chip.active { background: #ccfbf1; border-color: #14b8a6; color: #115e59; }
.tag-sub .tag-chip.active small { color: #0f766e; }
.tag-empty { font-size: 12px; color: var(--muted); padding: 6px 2px; }
.tag-chip.tag-drag-src { opacity: .3; }
.tag-drag-clone { position: fixed; z-index: 9999; pointer-events: none; transform: scale(1.1); box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* ===== نشان نام انبار (نام دلخواه) — کوچک‌تر و کوتاه‌شونده ===== */
.pc-codecol .wh-badge { font-size: 9.5px; padding: 1px 6px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.fc-title + .wh-badge, .wh-badge { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== دکمهٔ × (پاک‌کردن متن) در کادرهای جستجو: بزرگ‌تر و راحت‌تر برای لمس ===== */
#prod-search::-webkit-search-cancel-button,
#home-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  margin: 0;
  cursor: pointer;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.6' stroke-linecap='round'><path d='M6 6l12 12M18 6L6 18'/></svg>") center / 22px 22px no-repeat;
}
