/* ===========================================================
   سامانه مدیریت طرح‌های تحقیقاتی — Stylesheet
   پالت رنگی: سبز پژوهشی (Research Green) + طلایی دانه (Seed Gold)
   =========================================================== */

/* بارگذاری فونت وزیرمتن برای رفع مشکل تبدیل حروف/اعداد و ناسازگاری فونت */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/misc/Farsi-Digits/Vazirmatn-FD[wght].css');

/* ========= پشته فونت جامع با اولویت فارسی ========= */
:root {
	--rms-font-persian: "Vazirmatn FD", "Vazirmatn", "IRANSansX", "IRANSans", "B Nazanin", "Tahoma", "Arial", sans-serif;
	--rms-font-latin: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.rms-wrap, .rms-admin-wrap {
	--rms-primary: #1F6F54;
	--rms-primary-dark: #15503C;
	--rms-primary-light: #E7F2EC;
	--rms-gold: #C8932E;
	--rms-gold-light: #FBF1DD;
	--rms-bg: #F7F8F5;
	--rms-surface: #FFFFFF;
	--rms-text: #1E2A24;
	--rms-muted: #6B7770;
	--rms-border: #DEE5DE;
	--rms-danger: #C0392B;
	--rms-danger-light: #FBEAE8;
	--rms-radius: 10px;
	--rms-font: var(--rms-font-persian);

	font-family: var(--rms-font);
	color: var(--rms-text);
	background: var(--rms-bg);
	direction: rtl;
	text-align: right;
	line-height: 1.9;
	max-width: 1100px;
	margin: 0 auto;
	padding: 24px 18px 60px;
	/* اطمینان از رندر صحیح یونیکد/UTF-8 در تمام مرورگرها */
	-webkit-font-feature-settings: "kern" 1, "liga" 1;
	font-feature-settings: "kern" 1, "liga" 1;
}

.rms-admin-wrap { max-width: none; padding: 10px 0; background: transparent; }

.rms-wrap * , .rms-admin-wrap * { box-sizing: border-box; }

/* ========= متون بلند: چپ‌چین/راست‌چین خودکار + جاستیفای ========= */
/* فیلدهایی که محتوای آن‌ها paste یا تایپ می‌شود باید justify باشند */
.rms-justified, .rms-form textarea,
.rms-detail-wrap p,
.rms-academic-report p,
.proposal-abstract-text,
.rms-form-section p {
	text-align: justify;
	text-justify: inter-word;
	unicode-bidi: plaintext;       /* نمایش صحیح متون دو‌زبانه */
	word-break: break-word;
}

/* منابع: فارسی راست‌چین، لاتین چپ‌چین (کلاس توسط JS اضافه می‌شود) */
.rms-ref-fa  { direction: rtl; text-align: right; unicode-bidi: embed; }
.rms-ref-en  { direction: ltr; text-align: left;  unicode-bidi: embed; font-family: var(--rms-font-latin); }
.rms-references-list { list-style: none; padding: 0; margin: 0; }
.rms-references-list li { padding: 4px 0; line-height: 1.7; }

/* ========= تعمیر مشکل کپی‌پیست و تبدیل حروف/اعداد ========= */
.rms-form textarea,
.rms-form input[type=text],
.rms-editable-table input {
	unicode-bidi: plaintext;
	font-family: var(--rms-font-persian);   /* اجبار فونت فارسی برای جلوگیری از fallback ناخواسته */
	direction: rtl;
}
/* فیلدهایی که باید لاتین بمانند (عنوان انگلیسی، فیلد dir=ltr) */
[dir=ltr], input[dir=ltr] {
	direction: ltr !important;
	text-align: left !important;
	unicode-bidi: embed;
	font-family: var(--rms-font-latin);
}

/* ========= جداول مرتب‌شدنی (Sortable Tables) ========= */
.rms-table th.rms-sortable {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-left: 20px;
}
.rms-table th.rms-sortable::after {
	content: " ↕";
	font-size: 10px;
	opacity: 0.45;
	position: absolute;
	left: 4px;
}
.rms-table th.rms-sort-asc::after  { content: " ↑"; opacity: 1; color: var(--rms-gold); }
.rms-table th.rms-sort-desc::after { content: " ↓"; opacity: 1; color: var(--rms-gold); }
.rms-table tbody tr { transition: background .08s; }
.rms-table tbody tr:hover { background: #f0f5f2; }

.rms-wrap h2, .rms-admin-wrap h2 {
	font-size: 22px;
	font-weight: 800;
	color: var(--rms-primary-dark);
	margin: 0 0 16px;
	padding-bottom: 10px;
	border-bottom: 3px solid var(--rms-gold);
	display: inline-block;
}

.rms-wrap h3 { font-size: 17px; font-weight: 700; color: var(--rms-primary-dark); margin: 22px 0 10px; }

/* ---------------- Navigation ---------------- */
.rms-nav {
	background: linear-gradient(135deg, var(--rms-primary) 0%, var(--rms-primary-dark) 100%);
	border-radius: var(--rms-radius);
	padding: 6px 10px;
	margin-bottom: 18px;
	box-shadow: 0 2px 8px rgba(31,111,84,0.18);
}
.rms-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.rms-nav li a {
	display: block;
	padding: 11px 16px;
	color: #EAF3EE;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	border-radius: 8px;
	transition: background .15s ease, color .15s ease;
}
.rms-nav li a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.rms-nav li.active a { background: var(--rms-gold); color: #2b2106; }

.rms-user-pill {
	font-size: 13px;
	color: var(--rms-muted);
	margin-bottom: 22px;
	text-align: left;
}
.rms-user-pill a { color: var(--rms-primary); text-decoration: none; }

/* ---------------- Alerts ---------------- */
.rms-alert { padding: 12px 16px; border-radius: var(--rms-radius); margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.rms-alert-success { background: var(--rms-primary-light); color: var(--rms-primary-dark); border: 1px solid #BFE0CE; }
.rms-alert-error { background: var(--rms-danger-light); color: var(--rms-danger); border: 1px solid #F2C6C0; }

/* ---------------- Cards (dashboard stats) ---------------- */
.rms-cards, .rms-admin-cards { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0 26px; }
.rms-card, .rms-admin-card {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-top: 4px solid var(--rms-primary);
	border-radius: var(--rms-radius);
	padding: 16px 20px;
	min-width: 150px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.rms-card .num, .rms-admin-card .num { font-size: 28px; font-weight: 800; color: var(--rms-primary-dark); }
.rms-card .label, .rms-admin-card .label { font-size: 13px; color: var(--rms-muted); }

/* ---------------- Buttons ---------------- */
.rms-btn {
	display: inline-block;
	background: var(--rms-primary);
	color: #fff !important;
	border: none;
	border-radius: 8px;
	padding: 11px 22px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease, transform .05s ease;
}
.rms-btn:hover { background: var(--rms-primary-dark); }
.rms-btn:active { transform: translateY(1px); }
.rms-btn-secondary { background: var(--rms-gold); color: #2b2106 !important; }
.rms-btn-secondary:hover { background: #B6822A; }
.rms-btn-small { padding: 6px 14px; font-size: 13px; border-radius: 6px; margin-right: 8px; }

/* ---------------- Forms ---------------- */
.rms-form-wrap { background: var(--rms-surface); border: 1px solid var(--rms-border); border-radius: var(--rms-radius); padding: 24px; max-width: 760px; }
.rms-form label { display: block; font-weight: 700; font-size: 13px; margin: 16px 0 6px; color: var(--rms-primary-dark); }
.rms-form input[type=text], .rms-form input[type=number], .rms-form input[type=date],
.rms-form input[type=email], .rms-form textarea, .rms-form select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--rms-border);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	background: var(--rms-bg);
	color: var(--rms-text);
}
.rms-form input:focus, .rms-form textarea:focus, .rms-form select:focus {
	outline: 2px solid var(--rms-gold);
	outline-offset: 1px;
	border-color: var(--rms-primary);
}
.rms-form input[type=file] { padding: 8px 0; background: transparent; border: none; }
.rms-form-row { display: flex; gap: 16px; }
.rms-form-row > div { flex: 1; }
.rms-form-actions { margin-top: 22px; display: flex; gap: 10px; }
.rms-existing-attachments { margin-top: 8px; font-size: 13px; }

/* ---------------- Tables ---------------- */
.rms-table, .rms-print-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 13.5px; }
.rms-table th, .rms-table td { padding: 10px 12px; border-bottom: 1px solid var(--rms-border); text-align: right; }
.rms-table thead th { background: var(--rms-primary-light); color: var(--rms-primary-dark); font-weight: 700; }
.rms-table tbody tr:hover { background: #FAFBF9; }
.rms-actions a { color: var(--rms-primary); text-decoration: none; font-weight: 600; }
.rms-actions a:hover { text-decoration: underline; }

/* ---------------- Badges ---------------- */
.rms-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 999px;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
}

/* ---------------- Detail page ---------------- */
.rms-detail-wrap { background: var(--rms-surface); border: 1px solid var(--rms-border); border-radius: var(--rms-radius); padding: 26px; }
.rms-detail-header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rms-detail-header h2 { border: none; padding: 0; margin: 0; }
.rms-section-title { font-size: 15px; font-weight: 700; color: var(--rms-primary-dark); margin: 22px 0 8px; border-right: 4px solid var(--rms-gold); padding-right: 10px; }
.rms-print-links { margin: 16px 0; font-size: 13px; }
.rms-print-links a { color: var(--rms-primary); text-decoration: none; font-weight: 600; }

.rms-manager-panel, .rms-review-panel {
	background: var(--rms-gold-light);
	border: 1px solid #ECD9A8;
	border-radius: var(--rms-radius);
	padding: 18px 20px;
	margin: 22px 0;
}
.rms-panel-block { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px dashed #E0CB94; }
.rms-panel-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rms-panel-block select, .rms-panel-block input[type=text] {
	padding: 8px 10px; border-radius: 6px; border: 1px solid var(--rms-border); font-family: inherit; margin-bottom: 6px;
}
.rms-ajax-result { font-size: 13px; font-weight: 600; margin-right: 8px; }
.rms-ajax-result.ok { color: var(--rms-primary-dark); }
.rms-ajax-result.err { color: var(--rms-danger); }
.rms-assigned-reviewers { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; }
.rms-assigned-reviewers li { padding: 4px 0; }

.rms-review-panel input, .rms-review-panel textarea, .rms-review-panel select {
	display: block; width: 100%; max-width: 480px; margin-bottom: 10px; padding: 9px 12px;
	border-radius: 7px; border: 1px solid var(--rms-border); font-family: inherit;
}

/* ---------------- Attachments ---------------- */
.rms-attachments { list-style: none; padding: 0; margin: 0; }
.rms-attachments li { padding: 4px 0; }
.rms-attachments a { color: var(--rms-primary); text-decoration: none; }
.rms-attachments a:hover { text-decoration: underline; }

/* ---------------- Timeline / activity log ---------------- */
.rms-timeline { list-style: none; padding: 0; margin: 10px 0 0; border-right: 2px solid var(--rms-border); padding-right: 16px; }
.rms-timeline li { position: relative; padding: 6px 0; font-size: 13px; color: var(--rms-text); }
.rms-timeline li::before {
	content: ""; position: absolute; right: -21px; top: 13px; width: 8px; height: 8px;
	border-radius: 50%; background: var(--rms-primary);
}
.rms-time { color: var(--rms-muted); font-size: 12px; }

/* ---------------- Results (public) ---------------- */
.rms-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; }
.rms-result-card, .rms-result-card-full {
	background: var(--rms-surface); border: 1px solid var(--rms-border); border-right: 4px solid var(--rms-primary);
	border-radius: var(--rms-radius); padding: 16px 18px;
}
.rms-result-card-full { margin-bottom: 16px; }
.rms-result-summary { font-size: 13px; color: var(--rms-muted); margin-top: 6px; }

/* ---------------- Filters (manager list) ---------------- */
.rms-filters { font-size: 13px; margin-bottom: 14px; }
.rms-filters a { color: var(--rms-muted); text-decoration: none; padding: 4px 6px; }
.rms-filters a.active, .rms-filters a:hover { color: var(--rms-primary-dark); font-weight: 700; }

.rms-muted { color: var(--rms-muted); font-size: 13px; }

/* ---------------- Login ---------------- */
.rms-login-wrap { max-width: 420px; background: var(--rms-surface); border: 1px solid var(--rms-border); border-radius: var(--rms-radius); padding: 30px; margin: 60px auto; }
.rms-login-wrap p { margin: 10px 0; }
.rms-login-wrap label { font-weight: 700; font-size: 13px; display: block; margin-bottom: 5px; }
.rms-login-wrap input[type=text], .rms-login-wrap input[type=password] {
	width: 100%; padding: 10px; border: 1px solid var(--rms-border); border-radius: 8px; font-family: inherit;
}
.rms-login-wrap input[type=submit] {
	background: var(--rms-primary); color: #fff; border: none; border-radius: 8px; padding: 10px 24px;
	font-weight: 700; cursor: pointer; margin-top: 10px;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 680px) {
	.rms-form-row { flex-direction: column; }
	.rms-cards, .rms-admin-cards { flex-direction: column; }
	.rms-detail-header { flex-direction: column; align-items: flex-start; }
	.rms-nav ul { flex-direction: column; }
}

/* ---------------- Official proposal form (sections, codes, editable tables) ---------------- */
.rms-form-wide { max-width: 980px; }
.rms-form-section {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-radius: var(--rms-radius);
	padding: 18px 20px;
	margin-bottom: 18px;
}
.rms-form-section-title {
	font-size: 15px;
	font-weight: 800;
	color: #fff;
	background: linear-gradient(135deg, var(--rms-primary) 0%, var(--rms-primary-dark) 100%);
	padding: 9px 14px;
	border-radius: 7px;
	margin: -18px -20px 16px;
	width: calc(100% + 40px);
}
.rms-form-subsection-title {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--rms-primary-dark);
	background: var(--rms-primary-light);
	padding: 7px 12px;
	border-radius: 6px;
	margin: 18px 0 8px;
}
.rms-budget-category { margin-bottom: 8px; }

.rms-code-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 12px 16px;
}
.rms-code-grid label { margin: 0 0 4px; }
.rms-code-grid select, .rms-code-grid input { margin-bottom: 0; }

.rms-short-code-box {
	margin-top: 16px;
	background: var(--rms-gold-light);
	border: 1px dashed var(--rms-gold);
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
}
.rms-short-code-box strong { font-size: 17px; letter-spacing: 1px; color: var(--rms-primary-dark); }

.rms-editable-table { font-size: 12.5px; }
.rms-editable-table th { background: var(--rms-primary-light); color: var(--rms-primary-dark); font-size: 12px; padding: 6px 8px; }
.rms-editable-table td { padding: 4px 6px; vertical-align: middle; }
.rms-editable-table input, .rms-editable-table select {
	padding: 6px 8px; font-size: 12.5px; border: 1px solid var(--rms-border); border-radius: 5px;
	background: var(--rms-bg); width: 100%;
}
.rms-editable-table .rms-sum-row td, .rms-editable-table .rms-budget-cat-total {
	font-weight: 700; background: var(--rms-primary-light); color: var(--rms-primary-dark);
}
.rms-editable-table .rms-row-remove { color: var(--rms-danger); text-decoration: none; font-weight: 700; padding: 4px 8px; }
.rms-team-row-locked { background: #fbf8f0 !important; }
.rms-team-row-locked input, .rms-team-row-locked select { background: #f0ede0 !important; color: #6b5a2a; cursor: not-allowed; }

/* ---------------- پیشنهاد اصلاح متن با ردیابی تغییرات ---------------- */
.rms-suggest-box { background: #faf5ff; border: 1px solid #e0c9f7; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.rms-suggest-pending { background: #fdf9ec; border: 1px solid #ecdfc0; border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.rms-suggest-pending-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; margin-bottom: 6px; flex-wrap: wrap; gap: 6px; }
.rms-suggest-diff { line-height: 2; font-size: 13px; background: #fff; border: 1px solid var(--rms-border); border-radius: 6px; padding: 8px 10px; }
.rms-suggest-comment { font-size: 12px; color: #6b5a2a; margin: 6px 0 0; }
.rms-suggest-actions { display: flex; gap: 8px; margin-top: 8px; }
.rms-editable-table .rms-row-remove:hover { text-decoration: underline; }
.rms-timeline-table-wrap { overflow-x: auto; margin: 10px 0; }
#rms-timeline-table th, #rms-timeline-table td { white-space: nowrap; }
.rms-grand-total-row th, .rms-grand-total-row td { background: var(--rms-gold-light); font-weight: 800; font-size: 15px; }

/* ---------------- Print view: official numbered banners ---------------- */
.rms-tracking-box { float: left; border: 1px solid #333; padding: 8px 14px; font-size: 13px; }

/* ---------------- Weekly reports area: sub-navigation tabs ---------------- */
.rms-project-report-block {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-radius: var(--rms-radius);
	padding: 18px 20px;
	margin-bottom: 20px;
}
.rms-subtabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	border-bottom: 2px solid var(--rms-border);
	margin-bottom: 14px;
	padding-bottom: 4px;
}
.rms-subtabs a, .rms-subtabs span.rms-subtab-link {
	display: inline-block;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 700;
	color: var(--rms-muted);
	text-decoration: none;
	border-radius: 6px 6px 0 0;
}
.rms-subtabs a:hover { background: var(--rms-primary-light); color: var(--rms-primary-dark); }
.rms-subtabs .rms-subtab-link.active { background: var(--rms-primary); color: #fff; }

/* ---------------- نوار تب ثابت بخش‌های اجرای طرح (گزارش هفتگی/مراحل رشدی/نقشه/تصاویر/آنالیز/...) ---------------- */
.rms-map-compass-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 10px; }
.rms-map-cell-selected { outline: 2px solid #C8932E !important; background: #fbf1dd !important; }
.rms-map-compass-n, .rms-map-compass-s { font-weight: 800; color: #15503C; font-size: 13px; }
.rms-map-compass-middle { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; }
.rms-map-compass-w, .rms-map-compass-e { font-weight: 800; color: #15503C; font-size: 13px; writing-mode: vertical-rl; }

.rms-execution-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #15503C;
	border-radius: 10px;
	padding: 10px 16px;
	margin-bottom: 10px;
}
.rms-execution-code {
	font-size: 22px;
	font-weight: 900;
	color: #ffffff;
	letter-spacing: 1px;
	font-family: monospace, Tahoma;
}
@media print {
	.no-print, .rms-persistent-subnav { display: none !important; }
}
.rms-persistent-subnav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 20px;
	padding: 10px;
	background: #f7f8f5;
	border: 1px solid var(--rms-border);
	border-radius: 12px;
}
.rms-persistent-tab {
	--rms-tab-color: #1F6F54;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	font-size: 12.5px;
	font-weight: 700;
	text-decoration: none;
	color: var(--rms-tab-color);
	background: #fff;
	border: 2px solid var(--rms-tab-color);
	border-radius: 8px;
	transition: background .15s, color .15s;
	white-space: nowrap;
}
.rms-persistent-tab .rms-persistent-tab-icon { font-size: 14px; }
.rms-persistent-tab:hover { background: var(--rms-tab-color); color: #fff; }
.rms-persistent-tab.active { background: var(--rms-tab-color); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); }

/* ---------------- گالری تصاویر طرح ---------------- */
.rms-gallery-upload-form { background: #f7f8f5; border: 1px solid var(--rms-border); border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.rms-gallery-rows { display: flex; flex-direction: column; gap: 10px; }
.rms-gallery-row {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	background: #fff;
	border: 1px solid var(--rms-border);
	border-radius: 10px;
	padding: 10px 12px;
}
.rms-gallery-row img { width: 110px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rms-border); flex-shrink: 0; }
.rms-gallery-row-body { flex: 1; min-width: 0; }
.rms-gallery-row-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--rms-muted); margin-bottom: 4px; flex-wrap: wrap; }
.rms-gallery-row-title { font-weight: 700; font-size: 13.5px; color: var(--rms-text); }
.rms-gallery-row-note { font-size: 12.5px; color: var(--rms-text); margin-top: 4px; white-space: pre-line; }
.rms-gallery-row-actions { flex-shrink: 0; }
.rms-gallery-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.rms-gallery-picker label { display: flex; flex-direction: column; gap: 5px; cursor: pointer; border: 2px solid var(--rms-border); border-radius: 8px; padding: 6px; font-size: 11px; text-align: center; }
.rms-gallery-picker label:has(input:checked) { border-color: var(--rms-primary); background: var(--rms-primary-light); }
.rms-gallery-picker img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }

/* ---------------- کتابخانه دستورالعمل و فرم‌ها ---------------- */
.rms-guide-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; }
.rms-guide-filter {
	padding: 6px 14px;
	border: 1px solid var(--rms-border);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	color: var(--rms-text);
	text-decoration: none;
	background: #fff;
}
.rms-guide-filter:hover { background: var(--rms-primary-light); }
.rms-guide-filter.active { background: var(--rms-primary); color: #fff; border-color: var(--rms-primary); }
.rms-guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rms-guide-card {
	background: #fff;
	border: 1px solid var(--rms-border);
	border-radius: 12px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	position: relative;
}
.rms-guide-card-badge { position: absolute; top: 12px; left: 12px; font-size: 10px; background: #f0f5f2; padding: 3px 8px; border-radius: 6px; color: var(--rms-primary-dark); font-weight: 700; }
.rms-guide-card h3 { margin: 4px 60px 2px 0; font-size: 14.5px; }
.rms-guide-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.rms-guide-tag { font-size: 10px; background: var(--rms-primary-light); color: var(--rms-primary-dark); padding: 2px 8px; border-radius: 999px; }
.rms-guide-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.rms-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; margin: 6px 0 14px; }
.rms-checkbox-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.rms-radio-row { display: flex; gap: 20px; margin: 6px 0 14px; font-size: 13px; font-weight: 600; }
.rms-guide-content { line-height: 2; font-size: 14px; }
.rms-guide-content h2, .rms-guide-content h3 { color: var(--rms-primary-dark); margin: 22px 0 8px; }
.rms-guide-content img, .rms-guide-content svg { max-width: 100%; height: auto; border-radius: 10px; }
.rms-guide-stage { display: flex; gap: 16px; align-items: flex-start; background: #f7f8f5; border: 1px solid var(--rms-border); border-radius: 12px; padding: 14px; margin: 14px 0; }
.rms-guide-stage-icon { flex-shrink: 0; width: 110px; }
.rms-guide-stage-body { flex: 1; }
.rms-guide-stage-body h4 { margin: 0 0 6px; color: var(--rms-primary-dark); font-size: 14px; }

/* ---------------- نمودار میله‌ای ساده داشبورد تحلیلی مدیر ---------------- */
.rms-analytics-bars { display: flex; flex-direction: column; gap: 8px; }
.rms-analytics-bar-row { display: flex; align-items: center; gap: 10px; }
.rms-analytics-bar-label { width: 130px; flex-shrink: 0; font-size: 12.5px; font-weight: 700; color: var(--rms-text); }
.rms-analytics-bar-track { flex: 1; background: #f0f2ef; border-radius: 6px; height: 16px; overflow: hidden; }
.rms-analytics-bar-fill { height: 100%; border-radius: 6px; transition: width .3s; }
.rms-analytics-bar-value { width: 130px; flex-shrink: 0; font-size: 11.5px; color: var(--rms-muted); text-align: left; }

/* ---------------- تقویم پرتفولیوی طرح‌ها (Gantt) ---------------- */
.rms-portfolio-gantt { position: relative; margin-top: 30px; direction: rtl; }
.rms-portfolio-gridlines { position: relative; height: 22px; border-bottom: 2px solid var(--rms-border); margin-bottom: 6px; margin-right: 232px; }
.rms-portfolio-gridline { position: absolute; top: 0; height: 100%; border-right: 1px solid var(--rms-border); padding-right: 4px; }
.rms-portfolio-gridline span { font-size: 10px; color: var(--rms-muted); white-space: nowrap; }
.rms-portfolio-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f0f2ef; }
.rms-portfolio-row-label { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; font-size: 12px; }
.rms-portfolio-row-label strong { font-size: 12.5px; }
.rms-portfolio-track { position: relative; flex: 1; height: 20px; background: #f7f8f5; border-radius: 5px; }
.rms-portfolio-bar { position: absolute; top: 0; height: 20px; border-radius: 5px; opacity: 0.9; }
.rms-portfolio-bar.rms-portfolio-conflict { outline: 2px solid #d93025; outline-offset: 1px; }
.rms-locate-btn:hover { background: var(--rms-primary-light) !important; }

/* ---------------- دفترچه آزمایشگاهی الکترونیک (تاریخچه محتوای علمی) ---------------- */
.rms-snapshot-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.rms-snapshot-entry { background: #f7f8f5; border: 1px solid var(--rms-border); border-radius: 8px; padding: 10px 12px; }
.rms-snapshot-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.rms-snapshot-hash { background: #eee; padding: 1px 6px; border-radius: 4px; font-size: 10px; color: #888; margin-right: auto; }

/* ---------------- پرتفولیوی زمان‌بندی طرح‌ها (Gantt ساده) ---------------- */
.rms-portfolio-axis { position: relative; height: 24px; margin: 0 0 8px 160px; border-bottom: 1px solid var(--rms-border); }
.rms-portfolio-axis-tick { position: absolute; top: 0; font-size: 10.5px; color: var(--rms-muted); white-space: nowrap; transform: translateX(50%); }
.rms-portfolio-rows { display: flex; flex-direction: column; gap: 6px; }
.rms-portfolio-row { display: flex; align-items: center; gap: 10px; }
.rms-portfolio-row-label { width: 150px; flex-shrink: 0; font-size: 12px; font-weight: 700; }
.rms-portfolio-row-label a { color: var(--rms-text); text-decoration: none; }
.rms-portfolio-row-label a:hover { color: var(--rms-primary); }
.rms-portfolio-track { position: relative; flex: 1; height: 26px; background: #f7f8f5; border-radius: 6px; }
.rms-portfolio-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; opacity: .88; }

/* ---------------- برچسب‌های QR پلات مزرعه (چاپ‌پذیر) ---------------- */
.rms-qr-label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rms-qr-label {
	border: 1px dashed var(--rms-border);
	border-radius: 10px;
	padding: 10px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	background: #fff;
	break-inside: avoid;
}
.rms-qr-label img { display: block; margin: 0 auto; }
.rms-qr-label-text { display: flex; flex-direction: column; font-size: 11.5px; line-height: 1.5; }
.rms-qr-label-text strong { font-size: 13px; color: var(--rms-primary-dark); }
@media print {
	.rms-qr-print-page .rms-persistent-subnav,
	.rms-qr-print-page .rms-form-actions,
	.rms-qr-print-page > h2,
	.rms-qr-print-page > p.rms-muted { display: none !important; }
	.rms-qr-print-page .rms-qr-label-grid { gap: 6px; }
}

/* ---------------- تقویم شمسی (Jalali datepicker) ---------------- */
input.rms-jalali-date { cursor: pointer; background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231F6F54' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat left 8px center; background-size: 15px; padding-left: 26px !important; font-weight: 700; color: var(--rms-text); }
.rms-jalali-popup {
	background: #fff;
	border: none;
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(0,0,0,.28);
	padding: 0;
	width: 250px;
	font-family: inherit;
	direction: rtl;
	overflow: hidden;
}
.rms-jalali-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0;
	padding: 12px 14px;
	font-weight: 800;
	font-size: 15px;
	color: #ffffff;
	background: #15503C;
}
.rms-jalali-title {
	color: #ffffff !important;
	font-weight: 800;
	font-size: 15px;
}
.rms-jalali-nav {
	border: none;
	background: #ffffff;
	color: #15503C !important;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	font-weight: 900;
	box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.rms-jalali-nav:hover { background: #C8932E; color: #ffffff !important; }
.rms-jalali-week {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
	font-size: 11px;
	font-weight: 800;
	color: var(--rms-primary-dark);
	text-align: center;
	background: var(--rms-primary-light);
	padding: 8px 10px 6px;
}
.rms-jalali-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; }
.rms-jalali-days button {
	border: 1px solid var(--rms-border);
	background: #fff;
	color: var(--rms-text);
	border-radius: 7px;
	padding: 6px 0;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
}
.rms-jalali-days button:hover { background: var(--rms-primary); color: #fff; border-color: var(--rms-primary); }
.rms-jalali-days button.rms-jalali-is-today {
	background: #C8932E !important;
	border-color: #C8932E !important;
	color: #ffffff !important;
	font-weight: 900;
	box-shadow: 0 0 0 2px rgba(200,147,46,.35);
}
.rms-jalali-days button.rms-jalali-is-today:hover { background: #b17f28 !important; }

.rms-jalali-pick-month, .rms-jalali-pick-year {
	cursor: pointer;
	padding: 2px 5px;
	border-radius: 4px;
}
.rms-jalali-pick-month:hover, .rms-jalali-pick-year:hover { background: rgba(255,255,255,.2); }

.rms-jalali-month-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	padding: 12px;
}
.rms-jalali-month-cell {
	border: 1px solid var(--rms-border);
	background: #fff;
	color: var(--rms-text);
	border-radius: 7px;
	padding: 10px 4px;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
}
.rms-jalali-month-cell:hover { background: var(--rms-primary); color: #fff; border-color: var(--rms-primary); }
.rms-jalali-month-cell.rms-jalali-is-today { background: #C8932E !important; border-color: #C8932E !important; color: #fff !important; }

.rms-jalali-year-list {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	padding: 12px;
	max-height: 240px;
	overflow-y: auto;
}
.rms-jalali-year-cell {
	border: 1px solid var(--rms-border);
	background: #fff;
	color: var(--rms-text);
	border-radius: 7px;
	padding: 8px 4px;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
}
.rms-jalali-year-cell:hover { background: var(--rms-primary); color: #fff; border-color: var(--rms-primary); }
.rms-jalali-year-cell.rms-jalali-is-today { background: #C8932E !important; border-color: #C8932E !important; color: #fff !important; }
.rms-jalali-empty { visibility: hidden; border: none !important; background: none !important; }
.rms-jalali-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 10px 10px; }
.rms-jalali-foot button {
	flex: 1;
	border: 1px solid var(--rms-border);
	background: #f7f8f5;
	color: var(--rms-primary-dark);
	font-size: 11.5px;
	font-weight: 700;
	cursor: pointer;
	padding: 7px 0;
	border-radius: 7px;
}
.rms-jalali-foot button:hover { background: var(--rms-primary-light); border-color: var(--rms-primary); }
.rms-jalali-foot button.rms-jalali-clear { color: #d93025; }

/* ---------------- نوار عملیات دسته‌جمعی (حذف چند طرح) ---------------- */
.rms-bulk-actions-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.rms-bulk-actions-bar button:disabled { opacity: .45; cursor: not-allowed; }



/* ---------------- Final report: dynamic result table cards ---------------- */
.rms-result-table-card {
	background: var(--rms-bg);
	border: 1px solid var(--rms-border);
	border-radius: 8px;
	padding: 14px 16px;
	margin-bottom: 16px;
}
.rms-result-table-card .ft-table { margin-top: 10px; }

/* ---------------- Weekly progress chart ---------------- */
.rms-progress-chart-block {
	background: var(--rms-primary-light);
	border: 1px solid #BFE0CE;
	border-radius: var(--rms-radius);
	padding: 14px 16px;
	margin-bottom: 16px;
}
.rms-progress-chart-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 8px;
}
.rms-progress-chart-header strong { color: var(--rms-primary-dark); font-size: 14px; }
.rms-progress-filter { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.rms-progress-filter input { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--rms-border); font-size: 12px; }
.rms-progress-chart { width: 100%; max-width: 640px; }
.rms-progress-svg { width: 100%; height: auto; display: block; }

/* ---------------- Statistical analysis sections ---------------- */
.rms-analysis-wrap { max-width: 1100px; }
.rms-analysis-block {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-radius: var(--rms-radius);
	padding: 16px 18px;
	margin-bottom: 16px;
}
.rms-anova-table td:last-child { font-weight: 700; }
.rms-anova-table tr:last-child { background: var(--rms-primary-light); font-weight: 700; }

/* ── Unified Experiment Lab ── */
.rms-exp-wrap { max-width: 1100px; }
.rms-exp-tabs {
	display: flex;
	gap: 0;
	border-bottom: 2px solid var(--rms-border);
	margin-bottom: 0;
}
.rms-exp-tab {
	padding: 10px 22px;
	font-size: 13.5px;
	font-weight: 700;
	font-family: var(--rms-font-persian);
	background: var(--rms-bg);
	border: 1px solid var(--rms-border);
	border-bottom: none;
	border-radius: 8px 8px 0 0;
	cursor: pointer;
	color: var(--rms-muted);
	margin-left: 4px;
	transition: background .15s;
}
.rms-exp-tab.active {
	background: var(--rms-surface);
	color: var(--rms-primary-dark);
	border-color: var(--rms-border);
	border-bottom-color: var(--rms-surface);
	margin-bottom: -2px;
}
.rms-exp-tab:hover:not(.active) { background: var(--rms-primary-light); }

.rms-exp-statusbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: var(--rms-gold-light);
	border: 1px solid #d4a43a;
	border-top: none;
	padding: 8px 16px;
	font-size: 12.5px;
}
.rms-exp-panel {
	display: none;
	border: 1px solid var(--rms-border);
	border-top: none;
	padding: 18px;
	background: var(--rms-surface);
	border-radius: 0 0 var(--rms-radius) var(--rms-radius);
}
.rms-exp-panel.active { display: block; }

/* Design type card grid */
.rms-design-type-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 10px;
}
.rms-design-type-card {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 12px 14px;
	border: 2px solid var(--rms-border);
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .15s, background .15s;
	background: var(--rms-bg);
}
.rms-design-type-card input { display: none; }
.rms-design-type-card .rms-design-icon { font-size: 22px; }
.rms-design-type-card .rms-design-label { font-weight: 700; font-size: 12.5px; color: var(--rms-text); }
.rms-design-type-card .rms-design-desc { font-size: 11px; color: var(--rms-muted); }
.rms-design-type-card.selected {
	border-color: var(--rms-primary);
	background: var(--rms-primary-light);
}
.rms-design-type-card:hover { border-color: var(--rms-primary); }

/* Param fields — JS shows/hides them; start all visible so no JS = still usable */
.rms-pf { display: block; }
.rms-pf[style*="display: none"], .rms-pf[style*="display:none"] { display: none !important; }

/* Param grid */
.rms-param-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 12px;
	margin-bottom: 14px;
}
.rms-param-grid label { font-size: 12px; font-weight: 700; display: block; margin-bottom: 4px; }
.rms-param-grid input {
	width: 100%;
	padding: 9px 12px;
	border: 2px solid var(--rms-border);
	border-radius: 8px;
	font-size: 15px;
	font-family: monospace;
	text-align: center;
	transition: border-color .15s;
}
.rms-param-grid input:focus { border-color: var(--rms-primary); outline: none; }

/* Computed summary box */
.rms-exp-summary {
	padding: 10px 14px;
	background: var(--rms-primary-light);
	border-radius: 8px;
	font-size: 13px;
	color: var(--rms-primary-dark);
	margin-top: 10px;
}

/* Param fields — hidden by default is removed; JS uses .toggle() */

/* Genotype inputs grid */
.rms-genotype-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 8px;
	margin-top: 10px;
}
.rms-genotype-grid input {
	width: 100%;
	padding: 7px 10px;
	border: 1px solid var(--rms-border);
	border-radius: 7px;
	font-family: var(--rms-font-persian);
	font-size: 13px;
	background: var(--rms-bg);
}
.rms-genotype-grid .rms-geno-wrap { display: flex; flex-direction: column; gap: 2px; }
.rms-genotype-grid .rms-geno-num { font-size: 10px; color: var(--rms-muted); padding: 0 4px; }

/* Trait inputs */
.rms-trait-row {
	display: flex;
	gap: 6px;
	margin-bottom: 6px;
	align-items: center;
}
.rms-trait-row input {
	flex: 1;
	padding: 8px 10px;
	border: 1px solid var(--rms-border);
	border-radius: 7px;
	font-family: var(--rms-font-persian);
	font-size: 13px;
}
.rms-trait-row .rms-trait-del {
	background: none;
	border: none;
	color: var(--rms-danger);
	font-size: 16px;
	cursor: pointer;
	padding: 4px 8px;
}

/* Data grid */
.rms-exp-data-table { font-size: 12px; min-width: max-content; }
.rms-exp-data-table th { background: var(--rms-primary); color: #fff; padding: 7px 10px; white-space: nowrap; }
.rms-exp-data-table td { padding: 3px 4px; }
.rms-exp-data-table input {
	width: 80px;
	padding: 5px 6px;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-align: center;
	font-size: 12px;
	background: #fff;
	font-family: monospace;
}
.rms-exp-data-table .col-geno input { min-width: 120px; text-align: right; font-family: var(--rms-font-persian); }
.rms-exp-data-table .col-rep input { width: 50px; }
.rms-exp-data-table tr:nth-child(even) td { background: #f7f8f5; }
.rms-exp-data-table tr:hover td { background: #edf5f0; }
.rms-exp-data-table .rms-block-start td { border-top: 2px solid var(--rms-gold) !important; }

/* Analysis output */
#rms-analysis-output .rms-analysis-section {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-radius: 10px;
	padding: 16px 18px;
	margin-bottom: 16px;
}
#rms-analysis-output .rms-section-h {
	font-size: 14px;
	font-weight: 800;
	color: var(--rms-primary-dark);
	margin-bottom: 10px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--rms-border);
}

/* ── Data entry grid ── */
#rms-paste-area { direction: ltr; text-align: left; font-family: monospace; font-size: 12px; }

/* ---------------- Results table search/filter bar ---------------- */
.rms-results-search-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 14px;
}
.rms-results-search-bar input[type=text] {
	flex: 1;
	min-width: 180px;
	padding: 8px 12px;
	border: 1px solid var(--rms-border);
	border-radius: 8px;
	font-family: var(--rms-font-persian);
	direction: rtl;
}
.rms-results-search-bar select {
	padding: 8px 10px;
	border: 1px solid var(--rms-border);
	border-radius: 8px;
	font-family: var(--rms-font-persian);
}

/* ---------------- Dynamic reporting dashboard ---------------- */
.rms-reports-wrap { max-width: 1100px; }
.rms-report-filters {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-radius: var(--rms-radius);
	padding: 16px 18px;
	margin-bottom: 18px;
}
.rms-report-filters .rms-form-row { margin-bottom: 10px; }
.rms-report-filters label { font-size: 12px; margin-bottom: 4px; }
.rms-report-filters input, .rms-report-filters select { padding: 8px 10px; font-size: 13px; }

.rms-report-charts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 16px;
	margin: 20px 0;
}
.rms-report-chart-card {
	background: var(--rms-surface);
	border: 1px solid var(--rms-border);
	border-radius: var(--rms-radius);
	padding: 16px 18px;
}
.rms-report-chart-card h4 { margin: 0 0 12px; font-size: 13px; color: var(--rms-primary-dark); }

.rms-bar-chart { display: flex; flex-direction: column; gap: 8px; }
.rms-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rms-bar-label { width: 70px; flex-shrink: 0; color: var(--rms-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rms-bar-track { flex: 1; background: var(--rms-bg); border-radius: 5px; overflow: hidden; height: 14px; }
.rms-bar-fill { display: block; height: 100%; border-radius: 5px; transition: width .3s ease; }
.rms-bar-value { width: 34px; flex-shrink: 0; text-align: left; font-weight: 700; color: var(--rms-primary-dark); }

/* ---------------- Accessibility ---------------- */
.rms-wrap a:focus-visible, .rms-admin-wrap a:focus-visible,
.rms-wrap button:focus-visible, .rms-admin-wrap button:focus-visible {
	outline: 2px solid var(--rms-gold);
	outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
	.rms-wrap *, .rms-admin-wrap * { transition: none !important; }
}
