/* ═══════════════════════════════════════════════════════════
   فرم استعلام پیش‌فاکتور — فارم گستر
   تم شرکتی بر اساس رنگ‌های لوگو (سبز فیروزه‌ای تیره + خاکستری)
   نسخه ۲ — طراحی زیباتر باکس‌ها، رنگ‌ها و جزئیات
   ═══════════════════════════════════════════════════════════ */

/* ─── فونت وزیرمتن ─── */
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-ExtraBold.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

/* ─── متغیرها ─── */
:root {
  --primary: #12695B;
  --primary-dark: #0C4F44;
  --primary-deep: #093B33;
  --primary-mid: #177E6C;
  --primary-soft: #DFEFE9;
  --primary-softer: #F0F7F4;
  --gray: #575B59;
  --text: #182420;
  --muted: #64706B;
  --line: #DFE8E4;
  --bg: #F0F5F3;
  --card: #FFFFFF;
  --danger: #C0392B;
  --danger-soft: #FCEEEC;
  --danger-line: #F0C4BD;
  --amber: #C07C16;
  --amber-soft: #FCF3E1;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 1px 2px rgba(9, 59, 51, 0.05), 0 14px 38px rgba(9, 59, 51, 0.10);
  --shadow-sm: 0 1px 2px rgba(9, 59, 51, 0.05), 0 6px 18px rgba(9, 59, 51, 0.08);
  --ring: 0 0 0 4px rgba(18, 105, 91, 0.14);
}

/* ─── پایه ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px 380px at 88% -6%, rgba(18, 105, 91, 0.10), transparent 64%),
    radial-gradient(560px 340px at 4% 16%, rgba(18, 105, 91, 0.06), transparent 62%),
    radial-gradient(640px 420px at 50% 118%, rgba(192, 124, 22, 0.07), transparent 62%);
}
img { max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.spacer { flex: 1; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.nowrap { white-space: nowrap; }

::selection { background: var(--primary); color: #fff; }

/* اسکرول‌بار سفارشی */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C3D5CE; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #A5BDB4; }

/* ─── چیدمان اصلی ─── */
.page {
  max-width: 830px;
  margin: 0 auto;
  padding: 26px 20px 70px;
  position: relative;
  z-index: 1;
}

/* ─── ردیف لوگو و دکمه بازگشت به سایت ─── */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 6px;
  flex-wrap: wrap;
}
.brand img {
  height: 88px;
  width: auto;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(9, 59, 51, 0.14));
  transition: transform 0.25s ease;
}
.brand:hover img { transform: translateY(-2px); }

/* دکمه بازگشت به سایت اصلی فارم گستر */
.btn-site {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--primary-dark);
  border-radius: 99px;
  padding: 9px 18px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s, color 0.18s;
  min-height: 44px;
  white-space: nowrap;
}
.btn-site svg { flex-shrink: 0; transition: transform 0.2s; }
.btn-site:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(12, 79, 68, 0.28);
}
.btn-site:hover svg { transform: translate(-2px, -2px); }
.btn-site:focus-visible { outline: 3px solid rgba(18, 105, 91, 0.4); outline-offset: 2px; }

/* ─── معرفی ─── */
.hero { text-align: center; padding: 20px 10px 6px; }
.hero h1 {
  font-size: clamp(1.3rem, 3.6vw, 1.85rem);
  font-weight: 800;
  line-height: 1.7;
  background: linear-gradient(120deg, var(--primary-deep) 30%, var(--primary-mid) 75%, var(--amber) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary-deep);
}
.hero .sub1 {
  font-size: clamp(0.98rem, 2.3vw, 1.16rem);
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 10px;
}
.hero .sub2 { font-size: 0.9rem; color: var(--muted); margin-top: 5px; }
.hero-orn {
  width: 76px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--amber), var(--primary), var(--primary-mid));
  margin: 18px auto 0;
  box-shadow: 0 2px 8px rgba(18, 105, 91, 0.25);
}

/* دکمه مشاهده پیش‌فاکتورهای قبلی */
.hero-actions { margin-top: 18px; display: flex; justify-content: center; }
.lookup-open {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--primary-dark);
  border-radius: 99px;
  padding: 11px 24px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s, color 0.18s;
  min-height: 48px;
}
.lookup-open svg { color: var(--amber); flex-shrink: 0; }
.lookup-open:hover {
  border-color: var(--primary);
  background: var(--primary-softer);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(12, 79, 68, 0.20);
}
.lookup-open:focus-visible { outline: 3px solid rgba(18, 105, 91, 0.4); outline-offset: 2px; }

/* ─── کارت‌ها ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-top: 26px;
  animation: fadeUp 0.5s ease both;
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber) -20%, var(--primary) 40%, var(--primary-mid) 100%);
  opacity: 0.9;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* نشانگر مراحل */
.steps { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 12px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid var(--line);
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}
.step-chip .num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.step-chip .num svg { width: 12px; height: 12px; }
.step-chip.active {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-softer);
  box-shadow: 0 0 0 3px rgba(18, 105, 91, 0.10);
}
.step-chip.active .num { background: linear-gradient(135deg, var(--primary-mid), var(--primary-dark)); color: #fff; }
.step-chip.done { border-color: var(--primary); color: var(--primary-dark); }
.step-chip.done .num { background: var(--primary-soft); color: var(--primary-dark); }
.steps .connector {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--line), #CBDAD4);
  border-radius: 2px;
  min-width: 20px;
}

/* سربرگ کارت */
.card-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 22px; }
.icon-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-softer));
  border: 1px solid rgba(18, 105, 91, 0.14);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.card-head h2 { font-size: 1.1rem; font-weight: 800; color: var(--primary-deep); line-height: 1.6; }
.card-head .desc { font-size: 0.82rem; color: var(--muted); margin-top: 2px; line-height: 1.8; }

/* ─── فیلدها ─── */
.field { margin-bottom: 16px; }
.f-label { display: block; font-size: 0.88rem; font-weight: 700; margin-bottom: 8px; }
.req { color: var(--danger); }
.optional { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font: inherit;
  font-size: 0.95rem;
  background: #FAFCFB;
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(9, 59, 51, 0.04);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input::placeholder { color: #A6B1AC; }
.input:hover { border-color: #CBDAD4; }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: #fff;
}
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.10); }
.input.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}
textarea.input { resize: vertical; min-height: 92px; line-height: 1.9; }
.phone-input { text-align: left; letter-spacing: 0.6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── دکمه‌ها ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: none;
  border-radius: 13px;
  padding: 12px 22px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s, border-color 0.18s, color 0.18s;
  min-height: 47px;
}
.btn:focus-visible { outline: 3px solid rgba(18, 105, 91, 0.4); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(150deg, #17836F, var(--primary) 45%, var(--primary-dark));
  color: #fff;
  box-shadow: 0 7px 18px rgba(12, 79, 68, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  position: relative;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset-inline: 14px;
  top: 0;
  height: 45%;
  border-radius: 99px;
  background: linear-gradient(rgba(255, 255, 255, 0.14), transparent);
  pointer-events: none;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 11px 26px rgba(12, 79, 68, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:active { transform: none; }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.btn-ghost { background: #fff; border: 1.5px solid var(--line); color: var(--muted); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-softer); }
.btn-danger-ghost { background: #fff; border: 1.5px solid var(--danger-line); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: 0.84rem; border-radius: 10px; }
.card-actions { display: flex; gap: 12px; margin-top: 20px; align-items: center; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── پیام خطا ─── */
.form-error {
  display: none;
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
  align-items: center;
  gap: 8px;
}
.form-error.show { display: flex; }
.form-error svg { flex-shrink: 0; }

/* ═══════════ محصولات ═══════════ */
.products-list { display: flex; flex-direction: column; gap: 14px; }
.product-item {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  animation: fadeUp 0.35s ease both;
  box-shadow: var(--shadow-sm);
}
.product-item:hover { border-color: #BED4CC; box-shadow: var(--shadow); }
.product-item.invalid { border-color: var(--danger); }

.product-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--primary-softer), #FFFFFF);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.p-toggle { display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; padding: 0; font: inherit; }
.p-chevron { color: var(--primary-dark); display: grid; place-items: center; transition: transform 0.25s; }
.product-item.collapsed .p-chevron { transform: rotate(-90deg); }
.p-title { font-weight: 800; font-size: 0.93rem; color: var(--primary-deep); }
.p-side { display: flex; align-items: center; gap: 10px; }
.p-status {
  font-size: 0.71rem;
  font-weight: 700;
  padding: 3.5px 11px;
  border-radius: 99px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.p-status.complete {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: transparent;
}
.p-delete {
  background: none;
  border: none;
  color: #AEB8B4;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: color 0.18s, background 0.18s;
}
.p-delete:hover { color: var(--danger); background: var(--danger-soft); }
.product-body { padding: 18px 16px 8px; }
.product-item.collapsed .product-body { display: none; }

/* دکمه افزودن محصول */
.add-product {
  width: 100%;
  border: 2px dashed #AFD0C5;
  background: linear-gradient(180deg, var(--primary-softer), #fff);
  color: var(--primary-dark);
  border-radius: var(--radius);
  padding: 13px;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: background 0.2s, border-color 0.2s, transform 0.18s, box-shadow 0.18s;
  margin-top: 14px;
  min-height: 54px;
}
.add-product:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(12, 79, 68, 0.14);
}
.add-product:focus-visible { outline: 3px solid rgba(18, 105, 91, 0.35); outline-offset: 2px; }

/* ─── آپلود عکس ─── */
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #FAFCFB;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 14px;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}
.upload-empty .up-icon {
  color: var(--primary);
  opacity: 0.9;
  transition: transform 0.22s;
}
.upload-empty:hover .up-icon { transform: scale(1.12); }
.upload-empty small { font-size: 0.72rem; color: #99A5A0; font-weight: 500; }
.upload-preview { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.upload-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 11px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.up-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.up-name {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
  direction: ltr;
  text-align: right;
}
.up-remove {
  background: none;
  border: none;
  color: var(--danger);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
  padding: 0;
}
.up-remove:hover { text-decoration: underline; }
.up-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ═══════════ پنجره‌های مودال ═══════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 40, 34, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s, visibility 0.24s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: #fff;
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.30);
  padding: 26px;
  transform: translateY(18px) scale(0.97);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  position: relative;
}
.modal-overlay.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { font-size: 1.05rem; font-weight: 800; color: var(--primary-deep); }
.q-title { font-size: 0.9rem; font-weight: 800; margin: 16px 0 10px; color: var(--primary-deep); }

/* دکمه بستن مودال */
.lookup-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.18s, border-color 0.18s, background 0.18s, transform 0.18s;
  padding: 0;
}
.lookup-close:hover { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); transform: rotate(90deg); }
.lookup-close:focus-visible { outline: 3px solid rgba(18, 105, 91, 0.4); outline-offset: 2px; }

.type-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-opt {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.18s;
  font-weight: 700;
  font-size: 0.9rem;
}
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt .check {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid #C3D0CB;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s;
}
.type-opt .check svg { opacity: 0; transform: scale(0.4); transition: opacity 0.18s, transform 0.18s; }
.type-opt .t-ico { color: var(--primary-dark); display: grid; place-items: center; flex-shrink: 0; opacity: 0.85; }
.type-opt:hover { border-color: #AFD0C5; transform: translateY(-1px); }
.type-opt.selected {
  border-color: var(--primary);
  background: var(--primary-softer);
  box-shadow: 0 0 0 3px rgba(18, 105, 91, 0.12);
  transform: none;
}
.type-opt.selected .check { background: var(--primary); border-color: var(--primary); }
.type-opt.selected .check svg { opacity: 1; transform: scale(1); }

.modal-note {
  background: var(--primary-softer);
  border: 1px dashed #B4D2C8;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.8rem;
  color: var(--primary-dark);
  margin-top: 16px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  line-height: 1.9;
}
.modal-note svg { flex-shrink: 0; margin-top: 5px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ═══════════ پیگیری پیش‌فاکتورهای قبلی ═══════════ */
.lookup-modal { max-width: 560px; }
.lookup-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.9; margin-bottom: 14px; }
.lk-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  margin: 4px 0 12px;
}
.lk-list { display: flex; flex-direction: column; gap: 12px; max-height: 46vh; overflow-y: auto; padding-inline-end: 4px; }
.lk-card {
  border: 1.5px solid var(--line);
  border-radius: 15px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: fadeUp 0.35s ease both;
}
.lk-card:hover { border-color: #BED4CC; box-shadow: var(--shadow-sm); }
.lk-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--primary-softer), #fff);
  cursor: pointer;
  user-select: none;
}
.lk-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.lk-main { flex: 1; min-width: 0; }
.lk-code { font-weight: 800; font-size: 0.92rem; color: var(--primary-deep); }
.lk-code .code { letter-spacing: 1px; }
.lk-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lk-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #B7C6C0; }
.lk-chevron { color: var(--primary-dark); display: grid; place-items: center; transition: transform 0.25s; flex-shrink: 0; }
.lk-card.collapsed .lk-chevron { transform: rotate(-90deg); }
.lk-body { border-top: 1px solid var(--line); padding: 14px; background: #FDFEFE; }
.lk-card.collapsed .lk-body { display: none; }
.lk-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.lk-info-item {
  background: var(--primary-softer);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lk-info-item .li-label { font-size: 0.71rem; color: var(--muted); font-weight: 600; }
.lk-info-item .li-value { font-size: 0.85rem; font-weight: 700; overflow-wrap: anywhere; }
.lk-products-title { font-size: 0.8rem; font-weight: 800; color: var(--primary-deep); margin-bottom: 8px; }
.lk-product {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}
.lk-product:last-child { margin-bottom: 0; }
.lk-idx {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}
.lk-pbody { flex: 1; min-width: 0; }
.lk-pbody h5 { font-size: 0.86rem; font-weight: 800; line-height: 1.7; }
.lk-pbody p { font-size: 0.78rem; color: var(--muted); margin-top: 2px; white-space: pre-line; }
.lk-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  cursor: zoom-in;
}
.lk-noimg {
  width: 54px;
  height: 54px;
  border-radius: 9px;
  border: 1.5px dashed var(--line);
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  color: #A6B1AC;
  flex-shrink: 0;
}
.lk-empty {
  text-align: center;
  padding: 26px 14px 18px;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 600;
}
.lk-empty svg { color: #B7C6C0; margin-bottom: 10px; }
.lk-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 0 10px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.lk-loading .up-spinner { width: 20px; height: 20px; }

/* ═══════════ صفحه موفقیت ═══════════ */
.success-head { text-align: center; padding: 8px 0 4px; }
.check-circle {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-softer));
  border: 1.5px solid rgba(18, 105, 91, 0.18);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  color: var(--primary-dark);
  position: relative;
  animation: pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.check-circle::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid var(--primary-soft);
  animation: ring 1.6s ease-out infinite;
}
.check-circle svg { width: 38px; height: 38px; }
@keyframes pop {
  0%   { transform: scale(0.35); opacity: 0; }
  70%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes ring {
  0%   { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1.18); opacity: 0; }
}
.success-head h2 { font-size: 1.3rem; font-weight: 800; color: var(--primary-deep); }
.tracking-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  background: var(--primary-softer);
  border: 1.5px dashed var(--primary);
  border-radius: 14px;
  padding: 12px 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.tracking-box .t-label { font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.tracking-box .t-code { font-weight: 800; font-size: 1.14rem; color: var(--primary-deep); letter-spacing: 1.5px; direction: ltr; }

.summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 22px;
  box-shadow: var(--shadow-sm);
}
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; }
.summary-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  min-width: 0;
}
@media (min-width: 641px) {
  .summary-item:nth-child(odd) { border-inline-end: 1px solid var(--line); }
}
.summary-item.span2 { grid-column: 1 / -1; }
.s-label { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.s-value { font-size: 0.92rem; font-weight: 700; overflow-wrap: anywhere; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 13px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.formal   { background: var(--primary-soft); color: var(--primary-dark); border-color: rgba(18, 105, 91, 0.16); }
.badge.informal { background: #EDF0EF; color: var(--gray); border-color: #DFE5E2; }
.badge.new      { background: var(--amber-soft); color: var(--amber); border-color: rgba(192, 124, 22, 0.20); }
.badge.answered { background: var(--primary-soft); color: var(--primary-dark); border-color: rgba(18, 105, 91, 0.16); }

.s-products { margin-top: 22px; }
.s-products h3 {
  font-size: 0.94rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}
.s-product {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.s-idx {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.84rem;
  flex-shrink: 0;
}
.s-pbody { flex: 1; min-width: 0; }
.s-pbody h4 { font-size: 0.92rem; font-weight: 800; line-height: 1.7; }
.s-specs { font-size: 0.82rem; color: var(--muted); margin-top: 4px; white-space: pre-line; }
.s-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 11px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.s-noimg {
  width: 72px;
  height: 72px;
  border-radius: 11px;
  border: 1.5px dashed var(--line);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: #A6B1AC;
  flex-shrink: 0;
}
.success-note {
  background: var(--primary-softer);
  border: 1px dashed #B4D2C8;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.82rem;
  color: var(--primary-dark);
  margin-top: 16px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  line-height: 1.9;
}
.success-note svg { flex-shrink: 0; margin-top: 5px; }
.success-actions { display: flex; gap: 12px; margin-top: 22px; justify-content: center; flex-wrap: wrap; }

/* ═══════════ پنل مدیریت ═══════════ */
.adm-login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; position: relative; z-index: 1; }
.adm-login {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 34px 30px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: fadeUp 0.45s ease both;
  position: relative;
  overflow: hidden;
}
.adm-login::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--primary), var(--primary-mid));
}
.adm-lock {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-softer));
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid rgba(18, 105, 91, 0.14);
}
.adm-login .brand-mini { height: 60px; width: auto; margin-bottom: 12px; }
.adm-login h1 { font-size: 1.05rem; font-weight: 800; color: var(--primary-deep); }
.adm-login p { font-size: 0.82rem; color: var(--muted); margin: 4px 0 20px; }
.adm-login .form-error { text-align: right; }
.adm-backlink { display: inline-block; margin-top: 16px; font-size: 0.8rem; color: var(--muted); text-decoration: none; }
.adm-backlink:hover { color: var(--primary-dark); }

.adm-wrap { max-width: 1080px; margin: 0 auto; padding: 22px 16px 60px; position: relative; z-index: 1; }
.adm-topbar {
  background: linear-gradient(135deg, var(--primary-deep), var(--primary-dark) 55%, #116153);
  color: #fff;
  border-radius: var(--radius);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.adm-topbar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(340px 130px at 88% -20%, rgba(255, 255, 255, 0.14), transparent 70%);
  pointer-events: none;
}
.tb-right { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.tb-logo { height: 46px; width: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.tb-title { font-weight: 800; font-size: 0.98rem; }
.tb-left { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.btn-exit {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 10px;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: background 0.18s;
  min-height: 38px;
}
.btn-exit:hover { background: rgba(255, 255, 255, 0.22); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 3.5px;
  border-radius: 99px;
  background: var(--primary-soft);
}
.stat.accent::before { background: rgba(255, 255, 255, 0.45); }
.stat .s-num { font-size: 1.5rem; font-weight: 800; color: var(--primary-deep); line-height: 1.4; }
.stat .s-ttl { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.stat.accent { background: linear-gradient(140deg, var(--primary-mid), var(--primary-dark)); border: none; }
.stat.accent .s-num { color: #fff; }
.stat.accent .s-ttl { color: rgba(255, 255, 255, 0.82); }

.tabs { display: flex; gap: 6px; margin-top: 22px; border-bottom: 2px solid var(--line); }
.tab {
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  transition: color 0.18s, border-color 0.18s;
  border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--primary-dark); background: var(--primary-softer); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

.adm-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-top: 18px;
  animation: fadeUp 0.4s ease both;
  position: relative;
  overflow: hidden;
}
.adm-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  opacity: 0.75;
}
.adm-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.adm-search-form { flex: 1; min-width: 220px; }
.adm-search { position: relative; }
.adm-search svg {
  position: absolute;
  top: 50%;
  inset-inline-start: 13px;
  transform: translateY(-50%);
  color: #99A5A0;
  pointer-events: none;
}
.adm-search .input { padding-inline-start: 40px; }
.fchips { display: flex; gap: 7px; flex-wrap: wrap; }
.fchip {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.fchip:hover { border-color: var(--primary); color: var(--primary-dark); }
.fchip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(12, 79, 68, 0.24); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table.adm-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 760px; }
.adm-table th {
  background: var(--primary-softer);
  color: var(--primary-deep);
  font-weight: 800;
  padding: 11px 14px;
  text-align: right;
  white-space: nowrap;
  font-size: 0.79rem;
  border-bottom: 1px solid var(--line);
}
.adm-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover td { background: #F8FBFA; }
.code { font-weight: 800; color: var(--primary-deep); direction: ltr; display: inline-block; letter-spacing: 0.5px; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { display: inline-flex; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  padding: 0;
}
.icon-btn:hover { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-softer); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.empty-note { text-align: center; color: var(--muted); padding: 26px 14px; font-size: 0.88rem; }

/* جزئیات استعلام */
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-title { font-size: 1.1rem; font-weight: 800; color: var(--primary-deep); margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 20px; }
.detail-item {
  background: var(--primary-softer);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.d-label { font-size: 0.73rem; color: var(--muted); font-weight: 600; }
.d-value { font-size: 0.9rem; font-weight: 700; overflow-wrap: anywhere; }
.adm-subtitle { font-size: 0.92rem; font-weight: 800; color: var(--primary-deep); margin-bottom: 12px; }
.adm-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.adm-product { border: 1px solid var(--line); border-radius: 13px; padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); }
.ap-head { display: flex; align-items: center; gap: 9px; }
.ap-idx {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.ap-head h4 { font-size: 0.88rem; font-weight: 800; line-height: 1.6; }
.ap-specs { font-size: 0.8rem; color: var(--muted); white-space: pre-line; }
.ap-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: #fff;
}
.ap-noimg {
  height: 60px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: #A6B1AC;
}

/* ویرایش متن‌ها */
.text-editor .group { margin-bottom: 24px; }
.text-editor .group:last-of-type { margin-bottom: 10px; }
.group-title {
  font-weight: 800;
  color: var(--primary-deep);
  font-size: 0.92rem;
  margin-bottom: 12px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--line);
}
.t-row { display: grid; grid-template-columns: 230px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.t-row > label { font-size: 0.79rem; color: var(--muted); font-weight: 600; }
.t-row .input { background: #FAFCFB; }
.t-row textarea.input { min-height: 38px; padding-top: 8px; padding-bottom: 8px; line-height: 1.8; }

/* پیام شناور */
.toast {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 22px;
  background: var(--primary-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 13px;
  font-weight: 700;
  font-size: 0.87rem;
  box-shadow: var(--shadow);
  z-index: 80;
  animation: toastIn 0.3s ease both;
  transition: opacity 0.35s;
}
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } }

/* بزرگ‌نمایی عکس */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 24, 20, 0.78);
  display: none;
  place-items: center;
  z-index: 90;
  cursor: zoom-out;
  padding: 24px;
}
.lightbox.show { display: grid; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: #fff;
}

/* ═══════════ واکنش‌گرایی ═══════════ */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .page { padding: 16px 14px 52px; }
  .brand img { height: 62px; }
  .btn-site { padding: 8px 13px; font-size: 0.78rem; min-height: 40px; }
  .hero { padding-top: 14px; }
  .card { padding: 20px 16px; margin-top: 20px; }
  .row-2 { grid-template-columns: 1fr; gap: 0; }
  .steps { flex-wrap: wrap; }
  .steps .connector { display: none; }
  .step-chip { font-size: 0.76rem; padding: 6px 11px; }
  .card-actions { flex-wrap: wrap; }
  .card-actions .btn { flex: 1 1 100%; }
  .type-options { grid-template-columns: 1fr; }
  .modal { padding: 22px 16px; border-radius: 18px; }
  .summary-grid { grid-template-columns: 1fr; }
  .success-actions .btn { flex: 1 1 100%; }
  .lookup-open { width: 100%; justify-content: center; }
  .lk-info { grid-template-columns: 1fr; }
  .lk-list { max-height: 52vh; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .tb-title { display: none; }
  .t-row { grid-template-columns: 1fr; gap: 4px; }
  .adm-toolbar { align-items: stretch; }
  .up-name { max-width: 150px; }
}

/* کاهش حرکت برای دسترس‌پذیری */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* چاپ صفحه موفقیت */
@media print {
  body::before { display: none; }
  .btn, .btn-site, .brand, .hero-orn, .steps, .lookup-open { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}
