/* distco.ir — سامانه پایش شرکت‌های توزیع | RTL, Vazirmatn | Apple-style (v63 draft, CSS only) */
:root {
  /* پالت اپل — جایگزین زیتونی روشن */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: #e8f1fc;
  --accent-ring: rgba(0,113,227,.25);
  /* نام‌های قدیمی حفظ شده‌اند تا هیچ ارجاعی از قلم نیفتد؛ مقدارها اپلی‌اند */
  --olive: #0071e3;
  --olive-2: #0077ed;
  --olive-light: #0071e3;
  --olive-pale: #f5f5f7;
  --olive-soft: #e8f1fc;
  --heading: #1d1d1f;
  --olive-text-light: #6e6e73;
  /* قرمز توانیر: فقط مرجع برند؛ دیگر در کروم رابط کاربری به کار نمی‌رود */
  --tavanir-red: #e30613;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --bg: #f5f5f7;
  --card: #ffffff;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #d2d2d7;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Vazirmatn", -apple-system, "SF Pro Text", Tahoma, sans-serif;
  background: #f5f5f7;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}
a { color: var(--accent); }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.hidden { display: none !important; }

/* ---------- login ---------- */
/* پس‌زمینه صفحه ورود: سه تصویر سبک مرتبط با توانیر (دکل و خط انتقال،
   پست برق) با چرخش نرم؛ روی آن‌ها یک لایه تیره خنثی نیمه‌شفاف است تا
   کارت سفید خوانا بماند. تصویر اول همان اول بارگذاری می‌شود و بقیه
   در پس‌زمینه می‌آیند. */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #1d1d1f; position: relative; overflow: hidden; }
.login-bg { position: absolute; inset: 0; overflow: hidden; }
.login-bg-img { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; animation: loginBg 18s infinite; }
.login-bg-img:nth-child(1) { animation-delay: 0s; }
.login-bg-img:nth-child(2) { animation-delay: 6s; }
.login-bg-img:nth-child(3) { animation-delay: 12s; }
@keyframes loginBg {
  0% { opacity: 0; }
  8% { opacity: 1; }
  33% { opacity: 1; }
  41% { opacity: 0; }
  100% { opacity: 0; }
}
.login-bg::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.login-card { background: #fff; border-radius: 18px; padding: 32px; width: 100%; max-width: 420px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06), 0 20px 50px rgba(0,0,0,.18); position: relative; z-index: 1; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: var(--heading); }
.login-card p { color: var(--muted); margin: 0 0 20px; }
/* نشان توانیر در صفحه ورود: تنها تصویر طراحی سامانه؛ روی کارت سفید،
   بدون تاری و بدون پس‌زمینه ثابت — سبک و سریع. */
.login-logo { display: block; width: 140px; height: auto; margin: 0 auto 16px; }
.login-card .field { margin-bottom: 14px; }

/* ---------- layout ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
/* نوار بالای صفحه مثل اپل (۱۴۰۵/۰۹/۰۶): منوهای اصلی افقی در بالا؛ با هاور
   روی هر بخش، پنل کشویی زیر آن باز می‌شود و منتظر می‌ماند تا کاربر از
   همان پنل انتخاب کند یا به گزینهٔ دیگر برود. پنل به اندازهٔ محتواست تا
   طول متفاوت متن‌ها بد دیده نشود. */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  color: #1d1d1f; padding: 0 16px; height: 56px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.topbar-brand { flex-shrink: 0; line-height: 1.25; }
.topbar-title { font-size: 15px; font-weight: 700; color: #1d1d1f; white-space: nowrap; }
.topbar-sub { font-size: 11px; color: #6e6e73; }
.topnav { display: flex; align-items: stretch; height: 100%; min-width: 0; }
.topnav-item { position: relative; display: flex; align-items: stretch; flex-shrink: 0; }
.topnav-title {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: 0; color: #1d1d1f; font-size: 14px;
  padding: 0 12px; cursor: pointer; white-space: nowrap; height: 100%;
}
.topnav-title:hover { background: #f5f5f7; }
.topnav-item.active-section .topnav-title { color: #0071e3; font-weight: 600; }
.topnav-title .chev { display: inline-block; transition: transform .2s; font-size: 10px; color: #6e6e73; }
.topnav-item:hover .topnav-title .chev,
.topnav-item.open .topnav-title .chev { transform: rotate(180deg); }
.topnav-panel {
  position: absolute; top: 100%; right: 0; z-index: 101;
  padding-top: 8px; display: none;
  width: max-content; min-width: 220px; max-width: min(320px, calc(100vw - 16px));
}
.topnav-item:hover .topnav-panel,
.topnav-item.open .topnav-panel { display: block; }
.topnav-panel-inner {
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08);
  padding: 6px;
}
.topnav-panel-inner button {
  display: block; width: 100%; text-align: right; background: transparent;
  border: 0; color: #1d1d1f; padding: 9px 12px; border-radius: 10px; cursor: pointer;
  font-size: 14px; white-space: nowrap;
}
.topnav-panel-inner button:hover { background: #f5f5f7; }
.topnav-panel-inner button.active { background: #e8f1fc; color: #0071e3; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex-shrink: 0; font-size: 12px; color: #6e6e73; white-space: nowrap; }
.topbar-user button { background: transparent; border: 1px solid var(--border); color: var(--accent); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.main { flex: 1; padding: 22px 26px; min-width: 0; }
.main h2 { margin: 0 0 4px; font-size: 28px; font-weight: 600; color: var(--heading); }
.main .desc { color: var(--muted); margin: 0 0 18px; }

/* ---------- cards / KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06); }
.kpi .n { font-size: 26px; font-weight: 700; color: #1d1d1f; line-height: 1.2; }
.kpi .t { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06); }
.card h3 { margin: 0 0 12px; font-size: 20px; font-weight: 600; color: var(--heading); }
.card h4 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; color: var(--heading); }

/* ---------- داشبورد مدیریت (#/admin): کارت‌های آماری + بخش‌های کشویی ---------- */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 10px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06); }
.stat-num { font-size: 28px; font-weight: 700; color: #1d1d1f; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat-pending { /* بدون نوار رنگی بالا؛ مثل بقیه کارت‌ها */ }
.stat-pending .stat-num { color: #1d1d1f; }
.collapse-head { width: 100%; text-align: right; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 16px; font-weight: 700; color: var(--heading); padding: 0; display: flex; justify-content: space-between; align-items: center; }
.collapse-meta { font-size: 13px; font-weight: 400; color: var(--muted); }
.collapse-arrow { display: inline-block; transition: transform .2s; margin-right: 4px; }
.collapsible.collapsed .collapse-body { display: none; }
.collapsible.collapsed .collapse-arrow { transform: rotate(-90deg); }
.collapsible .collapse-body { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- موبایل (مدیران بیشتر با موبایل کار می‌کنند) ---------- */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  /* نوار بالا در موبایل: چندردیفه می‌شود؛ منوها در ردیف دوم می‌چینند و
     پنل هر بخش به‌صورت کشویی تمام‌عرض زیر نوار باز می‌شود (با
     position:static روی آیتم، پنل نسبت به نوار بالا جای می‌گیرد). */
  .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding: 8px 12px; gap: 8px; }
  .topbar-title { font-size: 14px; }
  .topnav { flex-wrap: wrap; width: 100%; order: 3; height: auto; }
  .topnav-item { position: static; height: 44px; }
  .topnav-title { padding: 0 10px; font-size: 13px; }
  .topnav-panel { right: 0; left: 0; width: auto; min-width: 0; max-width: none; }
  .topbar-user { font-size: 11px; }
  .topbar-user button { padding: 8px 14px; min-height: 36px; font-size: 13px; }
  /* هدف لمسی: دکمه‌ها و ورودی‌ها دست‌کم ۴۴ پیکسل ارتفاع دارند تا روی
     موبایل راحت لمس شوند؛ فونت ورودی‌ها ۱۶ پیکسل است تا آیفون هنگام
     لمس فیلد، صفحه را زوم نکند. */
  button, input, select, textarea { font-size: 16px; }
  input, select, textarea { padding: 12px; min-height: 44px; }
  .btn { padding: 12px 22px; min-height: 44px; }
  .btn.small { padding: 8px 14px; min-height: 36px; font-size: 14px; }
  .topnav-panel-inner button { padding: 12px 14px; min-height: 44px; }
  .jp-day { height: 40px; }
  .jp-nav { width: 40px; height: 40px; }
  .emg-tab-btn, .console-tab-btn { padding: 10px 16px; min-height: 44px; }
  .collapse-head { min-height: 44px; }
  .rte-toolbar button { padding: 8px 12px; min-height: 36px; }
  .main { padding: 14px 12px; }
  .main h2 { font-size: 22px; }
  .card { padding: 14px; margin-bottom: 14px; }
  .login-card { padding: 24px 20px; }
  .login-wrap { padding: 12px; }
  .mgmt-overall { padding: 16px; }
  .mgmt-overall-score { font-size: 32px; }
  .iran-map { max-width: 100%; }
  th, td { padding: 6px 8px; font-size: 13px; }
  .toolbar .field { min-width: 140px; }
  .kpis { gap: 10px; }
  .mgmt-programs { gap: 10px; }
  .form-grid { gap: 10px; }
}
@media (max-width: 400px) {
  body { font-size: 13px; }
  button, input, select, textarea { font-size: 13px; }
  .main { padding: 12px 10px; }
  .card { padding: 12px; }
}
.progress { height: 10px; background: #e8e8ed; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }
.sample-badge { background: var(--amber-soft); color: var(--amber); border-radius: 6px; padding: 1px 8px; font-size: 11px; font-weight: 700; }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.toolbar .field { min-width: 170px; flex: 1; }
.table-wrap { overflow-x: auto; }
/* جدول‌های خیلی پهن (۱۳ ستون به بالا: استانداردسازی، مهتاب، روشنایی،
   ساختمان‌ها، فیدرها، خاموشی) روی موبایل با شکستن متن خوانا نمی‌شوند؛
   این‌ها nowrap می‌مانند و فقط درون کارت خودشان اسکرول می‌خورند. */
.table-wrap.wide table { table-layout: auto; }
.table-wrap.wide th, .table-wrap.wide td { white-space: nowrap; }

/* جدول آیتم‌های نظارت عالیه — بدون نوار اسکرول، کادر ثابت: جدول دقیقاً به
   عرض کادر می‌نشیند و متن سلول‌ها می‌شکند (به‌جای اسکرول افقی). */
.fv-items-wrap { overflow-x: visible; }
.fv-items-wrap table { width: 100%; table-layout: fixed; }
.fv-items-wrap th, .fv-items-wrap td { white-space: normal; overflow-wrap: break-word; vertical-align: top; }
.fv-items-wrap th:nth-child(1), .fv-items-wrap td:nth-child(1) { width: 15%; }
.fv-items-wrap th:nth-child(2), .fv-items-wrap td:nth-child(2) { width: 17%; }
.fv-items-wrap th:nth-child(3), .fv-items-wrap td:nth-child(3) { width: 8%; }
.fv-items-wrap th:nth-child(4), .fv-items-wrap td:nth-child(4) { width: 12%; }
.fv-items-wrap th:nth-child(5), .fv-items-wrap td:nth-child(5) { width: 8%; }
.fv-items-wrap th:nth-child(6), .fv-items-wrap td:nth-child(6) { width: 24%; }
.fv-items-wrap th:nth-child(7), .fv-items-wrap td:nth-child(7) { width: 8%; }
.fv-items-wrap th:nth-child(8), .fv-items-wrap td:nth-child(8) { width: 8%; }

/* جدول فهرست نظارت‌ها — بدون نوار اسکرول، کادر ثابت: همان الگوی جدول
   آیتم‌ها (v71) برای فهرست نظارت‌ها؛ ستون‌های شمارنده باریک‌اند و
   عنوان و شرکت پهن‌تر. */
.fv-list-wrap { overflow-x: visible; }
.fv-list-wrap table { width: 100%; table-layout: fixed; }
.fv-list-wrap th, .fv-list-wrap td { white-space: normal; overflow-wrap: break-word; vertical-align: top; }
.fv-list-wrap th:nth-child(1), .fv-list-wrap td:nth-child(1) { width: 14%; }
.fv-list-wrap th:nth-child(2), .fv-list-wrap td:nth-child(2) { width: 15%; }
.fv-list-wrap th:nth-child(3), .fv-list-wrap td:nth-child(3) { width: 8%; }
.fv-list-wrap th:nth-child(4), .fv-list-wrap td:nth-child(4) { width: 9%; }
.fv-list-wrap th:nth-child(5), .fv-list-wrap td:nth-child(5) { width: 9%; }
.fv-list-wrap th:nth-child(6), .fv-list-wrap td:nth-child(6) { width: 6%; }
.fv-list-wrap th:nth-child(7), .fv-list-wrap td:nth-child(7) { width: 6%; }
.fv-list-wrap th:nth-child(8), .fv-list-wrap td:nth-child(8) { width: 6%; }
.fv-list-wrap th:nth-child(9), .fv-list-wrap td:nth-child(9) { width: 7%; }
.fv-list-wrap th:nth-child(10), .fv-list-wrap td:nth-child(10) { width: 6%; }
.fv-list-wrap th:nth-child(11), .fv-list-wrap td:nth-child(11) { width: 6%; }
.fv-list-wrap th:nth-child(12), .fv-list-wrap td:nth-child(12) { width: 8%; }

/* تب‌های بخش بسته اضطراری در کنسول و تب‌های کل کنسول — هر تب یک بخش یکپارچه است */
.emg-tabs, .console-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--border); margin: 4px 0 14px; }
.emg-tab-btn, .console-tab-btn { border: 0; background: none; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.emg-tab-btn:hover, .console-tab-btn:hover { color: var(--accent); }
.emg-tab-btn.active, .console-tab-btn.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.emg-tab-panel, .console-tab-panel { display: none; }
.emg-tab-panel.active, .console-tab-panel.active { display: block; }
table { border-collapse: collapse; width: 100%; background: #fff; }
/* جدول‌ها متن را می‌شکنند تا به‌جای اسکرول افقی، در عرض کادر جا شوند
   (رفع ریشه‌ای اسکرول افقی که روی همه جدول‌های داده بود؛ پیش‌تر فقط
   جدول‌های نظارت عالیه این رفتار را داشتند). جدول‌های خیلی پهن
   (مثل استانداردسازی با ۲۳ ستون) همچنان درون .table-wrap خودشان
   اسکرول می‌خورند، ولی صفحه هرگز اسکرول افقی نمی‌گیرد. */
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: right; white-space: normal; overflow-wrap: break-word; vertical-align: top; }
th { background: #f5f5f7; color: #1d1d1f; border-bottom: 1px solid var(--border); }
tr:nth-child(even) td { background: #fafafa; }
tbody tr:hover td { background: #eef4fc; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.calc-box { background: #f5f5f7; border-radius: 10px; padding: 12px 14px; }
.calc-box b { color: var(--accent); }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer; background: #0071e3; color: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,113,227,.18); }
.btn:hover { background: #0077ed; }
.btn.secondary { background: transparent; color: #0071e3; border: 1px solid #0071e3; box-shadow: none; }
.btn.secondary:hover { background: #e8f1fc; }
.btn.danger { background: var(--red); }
.btn.green { background: var(--green); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* دکمه‌های انتخاب بخش در فرم ارسال فایل — افقی، هم‌عرض */
#up-modules button { padding: 14px 8px; line-height: 1.6; }
@media (max-width: 480px) {
  #up-modules button { font-size: 13px; padding: 12px 6px; }
}

/* ---------- misc ---------- */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.alert.err { background: var(--red-soft); color: var(--red); border: 1px solid #fecaca; }
.alert.ok { background: var(--green-soft); color: var(--green); border: 1px solid #bbf7d0; }
.alert.info { background: #e8f1fc; color: #005fcc; border: 1px solid #bcd8f7; }
pre.code { background: #1d1d1f; color: #f5f5f7; border-radius: 10px; padding: 14px; direction: ltr; text-align: left; overflow-x: auto; font-size: 13px; }
.chat-box { border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 14px; max-height: 320px; overflow-y: auto; margin-bottom: 12px; }
.chat-msg { margin-bottom: 8px; }
.chat-msg.in { text-align: right; }
.chat-msg.out { text-align: left; }
.chat-msg span { display: inline-block; padding: 8px 12px; border-radius: 12px; max-width: 80%; }
.chat-msg.in span { background: #e8f1fc; }
.chat-msg.out span { background: #f5f5f7; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- داشبورد مدیریتی ---------- */
.mgmt-overall { text-align: center; padding: 22px; }
.mgmt-overall-score { font-size: 40px; font-weight: 700; line-height: 1.2; color: #1d1d1f; }
.mgmt-programs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.mgmt-program-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: box-shadow .2s ease, transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06); }
.mgmt-program-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-2px); }
.mgmt-program-card.selected { box-shadow: 0 0 0 2px var(--accent); }
.mgmt-prog-title { font-weight: 700; color: var(--heading); margin-bottom: 4px; }
.mgmt-prog-score { font-size: 24px; font-weight: 700; color: #1d1d1f; line-height: 1.3; margin-bottom: 6px; }
.band-chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mgmt-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.mgmt-company { margin-bottom: 16px; }
.mgmt-company-head { margin-bottom: 8px; }
.iran-map { max-width: 960px; margin: 0 auto; }
.map-card-full { grid-column: 1 / -1; }
.iran-map svg { width: 100%; height: auto; display: block; }
.iran-map svg path, .iran-map svg polygon { cursor: pointer; transition: filter .25s ease; }
.iran-map svg path:hover, .iran-map svg polygon:hover { filter: brightness(1.12); }
/* استان/شرکت انتخاب‌شده فقط با رنگ و قاب مشخص می‌شود؛ از نقشه جدا
   نمی‌شود و برچسبش هم سر جایش می‌ماند (درخواست کاربر ۱۴۰۵/۰۹/۰۱) */
.iran-map .prov-selected { filter: brightness(1.18); stroke: #0071e3; stroke-width: 2.5; }
/* برچسب نام شرکت روی نقشه: فونت صمیم (خواناتر از وزیرمتن در اندازه کوچک)؛
   هاله بر حسب رنگ متن است: متن سفید روی باند تیره هاله تیره می‌گیرد تا حروف
   چاق و تار نشوند، متن تیره روی باند روشن هاله سفید می‌گیرد */
.iran-map .map-label { font-family: "Samim", Tahoma, sans-serif; font-size: 13px; font-weight: 700; pointer-events: none; paint-order: stroke; stroke-width: 2; }
.iran-map .map-label-light { stroke: rgba(0,0,0,.45); }
.iran-map .map-label-dark { stroke: rgba(255,255,255,.9); }
.iran-map .prov-dimmed { opacity: .22; filter: grayscale(1); }
.iran-map .map-label-dimmed { opacity: .25; }
.iran-map .map-city-marker { pointer-events: none; }
/* دکمه بزرگ انتخاب شرکت در پنل جزئیات استان (جایگزین ساده کلیک روی
   دایره کوچک نقشه): تمام‌عرض، لمسی و واضح. */
.company-pick { display: block; width: 100%; text-align: right; margin: 8px 0; padding: 14px 16px; font-size: 1.05rem; }
/* شرکت انتخاب‌شده در پنل جزئیات / شرکت‌های دیگر کم‌رنگ */
.mgmt-company-selected { border: 2px solid #0071e3; border-radius: 12px; padding: 10px; }
.mgmt-company-dimmed { opacity: .45; filter: grayscale(.7); }
.mgmt-company-head[data-select-company] { cursor: pointer; }
/* ردیف برنامه قابل‌کلیک (باز کردن نمودارهای روند همان برنامه) */
.prog-row { cursor: pointer; }
.prog-row:hover td { background: #f5f5f7; }
/* تفاوت با میانگین کل شرکت‌ها */
.diff-up { color: #15803d; font-weight: 700; }
.diff-down { color: #dc2626; font-weight: 700; }
.diff-same { color: var(--muted); }
.seg-btn.active { background: var(--accent); color: #fff; }

/* ---------- بازدید میدانی: برچسب نتیجه + گزارش قابل چاپ ---------- */
.chip-ok, .chip-bad, .chip-warn { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip-ok { background: #dcfce7; color: #166534; }
.chip-bad { background: #fee2e2; color: #991b1b; }
.chip-warn { background: #fef3c7; color: #92400e; }
.fv-report { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.fv-report-head { text-align: center; border-bottom: 2px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
.fv-report-head h2 { margin: 0 0 4px; color: var(--heading); }
.fv-report-head p { color: var(--muted); margin: 0; font-size: 13px; }
.fv-report-meta { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.fv-report-meta th, .fv-report-meta td { border: 1px solid var(--border); padding: 8px 10px; text-align: right; font-size: 14px; }
.fv-report-meta th { background: #f5f5f7; color: var(--heading); width: 130px; }
.fv-report-item { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 14px; page-break-inside: avoid; }
.fv-report-item h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--heading); }
.fv-report-item p { margin: 4px 0; font-size: 14px; }
.fv-report-photo { max-width: 100%; max-height: 320px; border-radius: 8px; margin-top: 8px; }
.fv-report-sign { margin-top: 24px; display: flex; justify-content: space-between; font-size: 14px; }
@media print {
  .topbar, .no-print, #page-alert { display: none !important; }
  .shell { display: block !important; }
  .main { padding: 0 !important; margin: 0 !important; }
  .fv-report { border: none; padding: 0; }
  body { background: #fff !important; }
}

/* ---------- تقویم جدولی جلالی ---------- */
input.jalali-date { cursor: pointer; background: #fff; }
.jalali-picker { display: none; position: absolute; z-index: 1000; width: 272px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 12px; direction: rtl; }
.jp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jp-title { font-weight: 700; color: var(--heading); font-size: 15px; }
.jp-nav { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent); font-size: 18px; cursor: pointer; line-height: 1; }
.jp-nav:hover { background: #f5f5f7; }
.jp-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jp-day { height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; }
.jp-day:hover { background: #f5f5f7; }
.jp-day.jp-today { border: 1px solid var(--accent); color: var(--accent); font-weight: 700; }
.jp-day.jp-selected { background: var(--accent); color: #fff; font-weight: 700; }
.jp-day.jp-empty { cursor: default; }
.jp-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.jp-today-btn, .jp-clear-btn { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent); font-size: 13px; padding: 5px 12px; cursor: pointer; }
.jp-today-btn:hover, .jp-clear-btn:hover { background: #f5f5f7; }

/* ---------- کارت‌های بخش‌های سامانه ---------- */
.module-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.module-card { border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06); }
.module-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.module-card-head b { color: var(--heading); font-size: 16px; }
.module-card p { margin: 6px 0; font-size: 14px; }

/* ---------- ویرایشگر متن گزارش بازدید ---------- */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rte-toolbar button { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent); font-size: 13px; padding: 5px 10px; cursor: pointer; }
.rte-toolbar button:hover { background: #f5f5f7; }
.rte-editor { min-height: 180px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; outline: none; line-height: 1.9; }
.rte-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.rte-editor h2 { font-size: 20px; font-weight: 600; margin: 10px 0 6px; }
.rte-editor h3 { font-size: 17px; font-weight: 600; margin: 10px 0 6px; }
.rte-view { line-height: 1.9; }
.rte-view h2 { font-size: 20px; font-weight: 600; margin: 10px 0 6px; }
.rte-view h3 { font-size: 17px; font-weight: 600; margin: 10px 0 6px; }
.fv-report-text { margin: 16px 0; }
.fv-report-text h3 { border-bottom: 2px solid var(--border); padding-bottom: 6px; }

/* ---------- پیام‌ها ---------- */
.msg-badge { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.msg-unread { font-weight: 700; background: #e8f1fc; }
.msg-body { white-space: pre-wrap; }
.msg-row { cursor: pointer; }
