:root {
  /* دانا (FaNum) → وزیرمتن (برای نویسه‌های جاافتاده) → فونت‌های سیستمی */
  --font-sans: "Dana", "Vazirmatn", Tahoma, sans-serif;
  --accent: #009879;
  --accent-dark: #00785f;
  --accent-soft: #e6f5f1;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e3e8ee;
  --bg: #f5f7f9;
  --card: #ffffff;
  --red: #d64545;
  --red-soft: #fdeaea;
  --amber: #d98a00;
  --amber-soft: #fff3d6;
  --blue: #2f6fd6;
  --blue-soft: #e8f0fd;
  --violet: #7c5cd6;
  --violet-soft: #f0ebfc;
  --gray-soft: #eceff2;
  --radius: 10px;
  --input-h: 42.25px; /* ۱٫۷۵ × ۱۵px + padding و border */
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
/* ویژگی hidden باید همیشه برنده باشد، حتی روی عنصرهایی که display صریح دارند (grid، flex، inline-flex) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
h1 { font-size: 1.5rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr-end { text-align: right; unicode-bidi: plaintext; }

/* ---------- نوار بالا ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { font-size: 1.25rem; font-weight: 800; color: var(--accent); display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; }
.brand small { font-size: .82rem; font-weight: 400; color: var(--muted); }
/* لوگوی بن‌مانو (PNG شفاف با نوشتار مشکی/سبز؛ روی زمینهٔ سفید نوار خوانا است — نسخهٔ سفید نداریم) */
.brand-logo { display: block; height: 32px; width: auto; flex: none; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a:not(.btn) { padding: 6px 12px; border-radius: 8px; color: var(--ink); }
.nav a:not(.btn):hover { background: var(--gray-soft); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav .btn { margin-inline-start: 8px; }

.container { max-width: 1320px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- کارت و سرصفحه ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.card-title small { font-weight: 400; font-size: .8rem; }
.sub-title { font-size: .95rem; font-weight: 600; margin: 16px 0 6px; color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tracking-title { font-family: var(--font-sans); letter-spacing: .5px; }

/* ---------- دکمه ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
  padding: 8px 18px; border-radius: 8px; border: 1px solid transparent; line-height: 1.5;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-light { background: #fff; color: var(--accent-dark); }
.btn-light:hover { background: var(--accent-soft); }
.btn-sm { padding: 4px 12px; font-size: .88rem; }
.btn-lg { padding: 11px 30px; font-size: 1.05rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0, 152, 121, .35); outline-offset: 1px; }

/* ---------- فرم ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 16px; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; min-width: 0; }
.field label, .field .label { font-size: .88rem; font-weight: 600; color: #3d4852; }
.req { color: var(--red); }
input:not([type]), input[type=text], input[type=tel], input[type=email], input[type=search], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cdd5dd; border-radius: 8px; padding: 7px 10px;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input.invalid, .has-error input, .has-error select, .has-error textarea { border-color: var(--red); background: #fffafa; }
.field-error { color: var(--red); font-size: .84rem; }
.hint { color: var(--muted); font-size: .82rem; }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 14px; margin: 8px 0; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.check:hover { background: var(--accent-soft); }
.check input { margin-top: 5px; flex: none; }
.check .code { font-weight: 700; color: var(--accent-dark); }
.radios { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 4px 0; }
.radio { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 400 !important; }
.severity-row { margin-top: 12px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.stack > * + * { margin-top: 10px; }
.subset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 14px 0 0; }
.subset legend { padding: 0 6px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-error { background: var(--red-soft); border-color: #f3b5b5; color: #8f1f1f; }
.alert-success { background: var(--accent-soft); border-color: #a9dccd; color: #00533f; }

.success-banner {
  background: linear-gradient(135deg, var(--accent), #00b390); color: #fff; text-align: center;
  border-radius: var(--radius); padding: 22px 16px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.success-title { font-size: 1.1rem; font-weight: 600; }
.success-label { opacity: .9; font-size: .9rem; margin-top: 8px; }
.success-number { font-size: 2.6rem; font-weight: 800; letter-spacing: 2px; line-height: 1.3; }
.success-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* ---------- نشان‌ها ---------- */
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.sev-critical { background: var(--red-soft); color: #a62323; }
.sev-high { background: var(--amber-soft); color: #8a5800; }
.sev-normal { background: var(--gray-soft); color: #4a5560; }
.st-new { background: var(--blue-soft); color: #1e4fa3; }
.st-in_progress { background: var(--amber-soft); color: #8a5800; }
.st-waiting_customer { background: var(--violet-soft); color: #5a3fb0; }
.st-resolved { background: var(--accent-soft); color: #00633f; }
.st-closed { background: var(--gray-soft); color: #4a5560; }

.sla { display: inline-flex; align-items: center; vertical-align: middle; position: relative; /* تا متن .sr بیرون از جدول اسکرول‌دار نشت نکند */ }
.sla i { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: #9aa5b1; box-shadow: 0 0 0 3px rgba(154, 165, 177, .2); }
.sla-ok i { background: #1fa971; box-shadow: 0 0 0 3px rgba(31, 169, 113, .2); }
.sla-warning i { background: #f0a000; box-shadow: 0 0 0 3px rgba(240, 160, 0, .25); }
.sla-overdue i { background: var(--red); box-shadow: 0 0 0 3px rgba(214, 69, 69, .25); }
.sla-done i { background: #b9c2cb; box-shadow: none; }
.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.legend .sla { margin-inline-start: 4px; }

/* ---------- جدول ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { background: #f0f4f6; text-align: right; font-weight: 600; font-size: .84rem; color: #3d4852; padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: #fafcfc; }
table.data .num { text-align: center; }
table.data.compact td, table.data.compact th { padding: 5px 10px; font-size: .86rem; }
.tracking { font-weight: 700; direction: ltr; unicode-bidi: isolate; white-space: nowrap; display: inline-block; }
.cat-list { list-style: none; margin: 0; padding: 0; min-width: 200px; max-width: 300px; }
.cat-list li { font-size: .82rem; line-height: 1.5; padding: 1px 0; }
.cat-list b { color: var(--accent-dark); }
.cat-list-lg { max-width: none; }
.cat-list-lg li { font-size: .95rem; padding: 3px 0; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state .big-code { font-size: 3.5rem; font-weight: 800; color: var(--accent); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0; }
.overdue-text { color: #a62323; font-weight: 600; }
.tracking-list a { margin-inline-end: 8px; display: inline-block; }

/* ---------- فیلترها ---------- */
.filters { padding: 14px 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 14px; }
.filter-grid .span-2 { grid-column: span 2; }
.field-inline { justify-content: flex-end; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- صفحهٔ جزئیات ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.col-side { position: sticky; top: 76px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; margin: 0; }
.kv { min-width: 0; }
.kv-wide { grid-column: 1 / -1; }
.kv dt { font-size: .8rem; color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.kv-compact { grid-template-columns: 1fr 1fr; }
.sla-card .sla-state { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.sla-card-overdue { border-color: #f0b4b4; background: #fffafa; }
.attach-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attach-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.note-form { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.note-form .grid { margin-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 22px 14px 0; border-right: 2px solid var(--line); margin-right: 6px; }
.timeline li::before { content: ""; position: absolute; right: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.timeline li.system::before { background: #b0bac4; }
.tl-meta { font-size: .8rem; color: var(--muted); }
.tl-author { font-weight: 600; color: #3d4852; }
.timeline li.system .tl-body { color: var(--muted); font-size: .9rem; }

/* ---------- داشبورد ---------- */
.range-pills { display: flex; gap: 6px; align-items: center; }
.pill { padding: 3px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .88rem; }
.pill:hover { text-decoration: none; background: var(--gray-soft); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; color: var(--ink); border-top: 4px solid var(--accent); }
a.kpi:hover { text-decoration: none; background: #fafcfc; }
.kpi-label { font-size: .86rem; color: var(--muted); }
.kpi-value { font-size: 2.1rem; font-weight: 800; line-height: 1.3; }
.kpi-value small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.kpi-note { font-size: .78rem; color: var(--muted); }
.kpi-danger { border-top-color: var(--red); }
.kpi-danger .kpi-value { color: var(--red); }
.kpi-danger.kpi-ok { border-top-color: #1fa971; }
.kpi-danger.kpi-ok .kpi-value { color: #1fa971; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.chart-box { position: relative; height: 320px; }
.chart-empty { text-align: center; color: var(--muted); padding: 90px 0; }
.pareto-legend { margin-top: 12px; }

/* ---------- انتخابگر تاریخ ---------- */
.jd-popup { position: absolute; z-index: 1000; width: 288px; background: #fff; border: 1px solid #cdd5dd; border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); padding: 10px; font-size: .9rem; }
.jd-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.jd-nav { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 30px; height: 30px; font-size: 1.2rem; line-height: 1; cursor: pointer; font-family: inherit; }
.jd-nav:hover { background: var(--accent-soft); }
.jd-head select.jd-month { flex: 1; padding: 3px 6px; }
.jd-head input.jd-year { width: 64px; padding: 3px 6px; text-align: center; direction: ltr; }
.jd-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jd-wd { text-align: center; font-size: .78rem; color: var(--muted); padding: 2px 0; font-weight: 600; }
.jd-day { border: 0; background: transparent; border-radius: 6px; height: 32px; cursor: pointer; font: inherit; color: var(--ink); }
.jd-day:hover { background: var(--accent-soft); }
.jd-fri { color: var(--red); }
.jd-today { outline: 1px solid var(--accent); }
.jd-selected { background: var(--accent) !important; color: #fff !important; }
.jd-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.jd-link { border: 0; background: none; color: var(--accent-dark); cursor: pointer; font: inherit; font-weight: 600; }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 980px) {
  /* minmax(0, 1fr): جدول اقلام (کم‌ترین عرض بیشتر از موبایل) نباید ستون و کل صفحه را عریض کند؛ داخل .table-wrap اسکرول می‌خورد */
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  :root { --input-h: 40.5px; } /* ۱٫۷۵ × ۱۴px + ۱۶px */
  body { font-size: 14px; }
  .brand small { display: none; }
  .filter-grid .span-2 { grid-column: auto; }
  .checks { grid-template-columns: 1fr; }
  .success-number { font-size: 1.9rem; }
  .kv-compact { grid-template-columns: 1fr; }
}

/* ---------- هشدار زرد ---------- */
.alert-warning { background: var(--amber-soft); border-color: #f0d28a; color: #6b4600; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- واحد رسیدگی (کنترل کیفی / لجستیک و انبار) ---------- */
.unit-qc { background: var(--accent-soft); color: var(--accent-dark); border-color: #b9e2d6; }
.unit-logistics { background: var(--blue-soft); color: #1e4fa3; border-color: #c3d6f5; }
.unit-badge { display: inline-block; padding: 1px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid; white-space: nowrap; }
table.data .unit-badge { font-size: .78rem; padding: 0 9px; }

/* ---------- لیست کشویی قابل‌جستجو (combobox.js) ---------- */
.combo { position: relative; }
.combo .combo-input { height: var(--input-h); line-height: 1.5; padding-inline-end: 34px; font-size: 16px; /* جلوگیری از زوم خودکار iOS؛ ویژگی‌دارتر از قاعدهٔ عمومی input[type=text] */ }
.combo-toggle { position: absolute; inset-inline-end: 1px; top: 1px; bottom: 1px; width: 32px; border: 0; background: transparent; color: var(--muted); font-size: 1rem; cursor: pointer; border-radius: 0 7px 7px 0; }
.combo.is-open .combo-input { border-color: var(--accent); }
.combo-list { position: absolute; z-index: 60; inset-inline: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 18rem; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: #fff; border: 1px solid #cdd5dd; border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); }
.combo-up .combo-list { top: auto; bottom: calc(100% + 4px); }
.combo-option { padding: 10px 12px; min-height: 44px; display: flex; align-items: center; border-radius: 7px; cursor: pointer; line-height: 1.5; }
.combo-option.is-active { background: var(--accent-soft); }
.combo-option.is-selected { font-weight: 700; color: var(--accent-dark); }
.combo-option:active { background: #cdebe3; }
.combo-empty { padding: 12px; color: var(--muted); text-align: center; }

/* ---------- انتخاب چندفایلی (filepicker.js) ---------- */
.field-group { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.file-picker { gap: 8px; }
.file-rows { display: flex; flex-direction: column; gap: 8px; }
.file-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px dashed #cdd5dd; border-radius: 8px; background: #fbfcfd; }
.file-choose { position: relative; cursor: pointer; flex: none; }
.file-choose:focus-within { outline: 3px solid rgba(0, 152, 121, .35); outline-offset: 1px; }
.js .file-choose input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.file-names { list-style: none; margin: 0; padding: 0; flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.file-item { display: flex; align-items: center; gap: 8px; padding: 3px 8px; background: #fff; border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.file-item .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fs { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.file-item.too-big { border-color: var(--red); background: var(--red-soft); }
.file-remove { border: 0; background: transparent; color: #8a94a0; font-size: 1.4rem; line-height: 1; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; flex: none; }
.file-remove:hover, .file-remove:focus-visible { background: var(--red-soft); color: var(--red); }
.file-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }
.upload-form .file-picker { width: 100%; }

/* ---------- تنظیمات / محصولات ---------- */
.card-title.pad { padding: 14px 20px 10px; margin: 0; }
.product-add { align-items: flex-end; }
.product-add .grow, .grow { flex: 1 1 280px; }
.products-table td { vertical-align: middle; }
.products-table tr.inactive td { background: #fafafa; }
.products-table tr.inactive input[type=text] { color: var(--muted); }
.products-table tr:target td { background: var(--accent-soft); }
.rename-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rename-form input[type=text] { flex: 1 1 200px; min-width: 150px; }
.mini-form { display: inline-flex; gap: 4px; }
.order-col { white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; color: var(--ink); font-size: .8rem; }
.icon-btn:hover:not(:disabled) { background: var(--accent-soft); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- داشبورد: تفکیک استان و تاگل پارتو ---------- */
.pareto-toggle { margin-bottom: 10px; }
.province-table .bar-col { width: 35%; min-width: 90px; }
.province-table .bar { display: block; height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.province-table tr.muted-row td { color: var(--muted); }

/* ---------- ویرایش اطلاعات مشتری (صفحهٔ جزئیات) ---------- */
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-title-row h2 { font-size: inherit; font-weight: inherit; margin: 0; }
.btn.is-active { background: var(--accent-soft); border-color: #b9e2d6; color: var(--accent-dark); }
.customer-edit { margin-top: 2px; }
.customer-edit .form-actions { margin-top: 12px; }
/* بدون JS دکمهٔ باز/بسته کار نمی‌کند؛ فرم همیشه دیده می‌شود */
html:not(.js) .customer-edit[hidden] { display: block; }
html:not(.js) [data-toggle-edit] { display: none; }

/* select بومی ارتفاعش را از متریک فونت می‌گیرد؛ با فیلدهای متنی (۱٫۷۵em + padding و border) هم‌اندازه می‌شود تا با تغییر فونت ۱px جابه‌جا نشود */
select { min-height: calc(1.75em + 16px); }

/* ---------- شناسه‌های باشگاه مشتریان در سرصفحهٔ جزئیات (فقط‌خواندنی) ---------- */
.head-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.club-refs { display: flex; gap: 8px; flex-wrap: wrap; font-size: .88rem; }
.club-ref { padding: 1px 12px; border-radius: 999px; background: var(--violet-soft); color: #5a3fb0; border: 1px solid #d9cff5; }
.club-ref b { font-weight: 600; }

/* ---------- محصول مورد شکایت: ردیف‌های تکرارشونده (items.js) و جدول اقلام ---------- */
.js-only { display: inline-flex; }
html:not(.js) .js-only { display: none !important; }
.item-rows { display: flex; flex-direction: column; gap: 12px; }
.item-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 12px; background: #fbfcfd; }
.item-row.has-row-error { border-color: var(--red); background: #fffafa; }
.item-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.item-row-title { font-weight: 700; font-size: .9rem; color: var(--muted); }
.item-remove { width: 34px; height: 34px; padding: 0; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #8a94a0; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.item-remove:hover:not(:disabled), .item-remove:focus-visible { background: var(--red-soft); color: var(--red); }
.item-remove:disabled { opacity: .35; cursor: not-allowed; }
.item-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
.item-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.items-editor.has-error > .field-error { margin-top: 6px; }
.purchase-row { margin-top: 14px; }
.purchase-kv { margin-top: 12px; }
.items-edit-by { margin-top: 12px; }
.items-table td { vertical-align: middle; }
.more-items { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); font-size: .78rem; font-weight: 600; cursor: help; }
@media (max-width: 760px) {
  .item-grid { grid-template-columns: 1fr 1fr; }
  .item-product { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .item-grid { grid-template-columns: 1fr; }
}

/* فیلدهای شرطی (نام فروشگاه / محل خرید): بدون JS هر دو دیده می‌شوند تا قابل پرکردن باشند */
html:not(.js) [data-show-types][hidden] { display: block !important; }

/* تفکیک واحد رسیدگی در کارت‌های KPI داشبورد */
.kpi-split { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kpi-unit { font-size: .78rem; padding: 0 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.kpi-unit b { font-weight: 700; }

/* ---------- تنظیمات: زبانه‌ها و جدول SLA ---------- */
.subnav { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 7px 18px; border-radius: 8px 8px 0 0; color: var(--ink); border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.subnav a:hover { background: var(--gray-soft); text-decoration: none; }
.subnav a.active { background: var(--card); border-color: var(--line); color: var(--accent-dark); font-weight: 700; }
.sla-table th.sla-row-label { background: #fafcfc; white-space: nowrap; }
.sla-table td { vertical-align: top; }
.sla-table .sla-input { width: 8rem; max-width: 100%; text-align: center; }   /* (۰،۲،۰) تا از input[type=text] عمومی (width:100%) قوی‌تر باشد */
.sla-table td.has-error input { border-color: var(--red); background: #fffafa; }
.sla-by { margin-top: 12px; max-width: 360px; }
.alert-info { background: var(--blue-soft); border-color: #c3d6f5; color: #1e4fa3; }
@media (max-width: 600px) {
  /* جدول SLA سه‌ستونی باید در ۳۷۵px بدون اسکرول افقی جا شود: عنوان و برچسب ردیف بشکنند، فیلدها باریک‌تر */
  .sla-table.data th, .sla-table.data td { padding: 8px 5px; white-space: normal; }
  .sla-table.data th.sla-row-label { min-width: 5.2rem; }
  .sla-table .sla-input { width: 4.4rem; padding-inline: 4px; }
}

/* ---------- ورود، حساب کاربری و مدیریت کاربران ---------- */
.nav-user { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; padding-inline-start: 10px; border-inline-start: 1px solid var(--line); }
.nav-user .user-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.logout-form { margin: 0; display: inline; }
.auth-wrap { display: flex; justify-content: center; padding: 24px 0 12px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; padding: 26px 26px 20px; }
.auth-card .field, .auth-card .radio { text-align: start; }
.auth-card form { text-align: start; margin-top: 14px; }
.auth-logo { display: block; margin: 0 auto 10px; height: 64px; width: auto; }
.auth-sub { margin: 4px 0 0; }
.auth-submit { width: 100%; }
.auth-note { margin-top: 14px; }
.auth-form { max-width: 460px; }
.registrar { margin: 0 0 4px; }
.users-table td, .roles-table td { vertical-align: top; }
.roles-table th[scope=row] { white-space: nowrap; text-align: start; }
