/* =====================================================================
 * حزمة أدوات دليلك للوظائف — تنسيق مشترك
 *
 * ملف واحد يخدم الأدوات الخمس. لا يُحمَّل إلا في صفحة تحوي شورت كود
 * إحداها، ويُخزَّن في كاش المتصفح فيخدم بقية صفحات الأدوات بلا طلب جديد.
 * RTL أصيل، بلا خطوط ولا مكتبات خارجية.
 * ===================================================================== */

.dlt {
	--dlt-blue: #0073e6;
	--dlt-blue-dark: #0a4fa3;
	--dlt-ink: #14202e;
	--dlt-muted: #5b6b7c;
	--dlt-line: #e3e9f0;
	--dlt-soft: #f6f9fc;
	--dlt-ok: #16a34a;
	--dlt-warn: #f59e0b;
	--dlt-bad: #dc2626;
	--dlt-r: 14px;

	direction: rtl;
	text-align: right;
	font-family: inherit;
	color: var(--dlt-ink);
	max-width: 880px;
	margin-inline: auto;
}

.dlt *,
.dlt *::before,
.dlt *::after { box-sizing: border-box; }

/* ===== الترويسة ===== */

.dlt-head { margin-bottom: 22px; text-align: center; }

.dlt-eyebrow {
	display: inline-block;
	margin-bottom: 10px;
	padding: 5px 15px;
	border-radius: 999px;
	background: rgba(0, 115, 230, .1);
	color: var(--dlt-blue-dark);
	font-size: .8rem;
	font-weight: 800;
}

.dlt-head h2,
.dlt-head h1 {
	margin: 0 0 8px;
	font-size: 1.55rem;
	font-weight: 800;
	line-height: 1.6;
	color: var(--dlt-ink);
}

.dlt-head p {
	margin: 0;
	color: var(--dlt-muted);
	font-size: .97rem;
	line-height: 1.9;
}

/* ===== البطاقة ===== */

.dlt-card {
	background: #fff;
	border: 1px solid var(--dlt-line);
	border-radius: var(--dlt-r);
	padding: 24px;
	box-shadow: 0 2px 10px rgba(20, 32, 46, .04);
}

.dlt-card + .dlt-card { margin-top: 18px; }

/* ===== الحقول ===== */

.dlt-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.dlt-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dlt-span-2 { grid-column: 1 / -1; }

.dlt-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }

.dlt-field > label,
.dlt-label {
	font-size: .9rem;
	font-weight: 700;
	color: var(--dlt-ink);
}

.dlt-hint {
	font-size: .78rem;
	font-weight: 500;
	color: var(--dlt-muted);
	line-height: 1.7;
}

.dlt input[type="text"],
.dlt input[type="number"],
.dlt input[type="date"],
.dlt input[type="email"],
.dlt input[type="tel"],
.dlt select,
.dlt textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1.5px solid var(--dlt-line);
	border-radius: 10px;
	background: #fff;
	color: var(--dlt-ink);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.6;
	transition: border-color .16s ease, box-shadow .16s ease;
	-webkit-appearance: none;
	appearance: none;
}

.dlt select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b7c' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 12px center;
	background-size: 17px;
	padding-inline-start: 40px;
}

.dlt textarea { resize: vertical; min-height: 110px; line-height: 1.9; }

.dlt input:focus,
.dlt select:focus,
.dlt textarea:focus {
	outline: none;
	border-color: var(--dlt-blue);
	box-shadow: 0 0 0 3px rgba(0, 115, 230, .14);
}

/* الأرقام: نخفي أسهم المتصفح — تربك على الجوال ولا تُستعمل */
.dlt input[type="number"] { -moz-appearance: textfield; }
.dlt input[type="number"]::-webkit-outer-spin-button,
.dlt input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* حقل بلاحقة نصية (ريال)
 * اللاحقة تُثبَّت على الحقل نفسه لا على الخانة، وإلا نزلت فوق نص التلميح
 * في الحقول التي تحمل تلميحاً أسفلها. */
.dlt-money { position: relative; display: block; }
.dlt-money input { padding-inline-start: 58px; }
.dlt-money::after {
	content: attr(data-suffix);
	position: absolute;
	inset-inline-start: 14px;
	top: 50%;
	transform: translateY(-50%);
	font-size: .85rem;
	font-weight: 700;
	color: var(--dlt-muted);
	pointer-events: none;
}

/* مباعدات صغيرة تغني عن الأنماط السطرية في الوسم */
.dlt-block { margin-bottom: 18px; }
.dlt-mt { margin-top: 12px; }
.dlt-mt-sm { margin-top: 8px; }

/* ===== أزرار الاختيار (تقويم / جنسية) ===== */

.dlt-seg {
	display: flex;
	gap: 6px;
	padding: 5px;
	border: 1.5px solid var(--dlt-line);
	border-radius: 12px;
	background: var(--dlt-soft);
}

.dlt-seg label {
	flex: 1;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 8px;
	border-radius: 8px;
	font-size: .9rem;
	font-weight: 700;
	color: var(--dlt-muted);
	cursor: pointer;
	transition: background .16s ease, color .16s ease;
	text-align: center;
}

.dlt-seg input { position: absolute; opacity: 0; pointer-events: none; }
.dlt-seg label:has(input:checked) { background: var(--dlt-blue); color: #fff; box-shadow: 0 2px 8px rgba(0, 115, 230, .28); }
.dlt-seg label:has(input:focus-visible) { outline: 2px solid var(--dlt-blue); outline-offset: 2px; }

/* احتياط للمتصفحات بلا :has() — الصنف يضعه الجافاسكربت */
.dlt-seg label.is-on { background: var(--dlt-blue); color: #fff; }

/* ===== مربع اختيار ===== */

.dlt-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 13px 15px;
	border: 1.5px solid var(--dlt-line);
	border-radius: 10px;
	background: var(--dlt-soft);
	cursor: pointer;
	font-size: .88rem;
	line-height: 1.8;
}

.dlt-check input { margin-top: 4px; accent-color: var(--dlt-blue); width: 17px; height: 17px; flex: none; }
.dlt-check b { display: block; font-weight: 800; }
.dlt-check span { color: var(--dlt-muted); font-size: .82rem; }

/* ===== الأزرار ===== */

.dlt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.dlt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	flex: 1 1 200px;
	padding: 14px 26px;
	border: none;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--dlt-blue-dark) 0%, var(--dlt-blue) 100%);
	color: #fff;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 800;
	cursor: pointer;
	text-decoration: none;
	box-shadow: 0 4px 16px rgba(0, 115, 230, .26);
	transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.dlt-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 115, 230, .34); color: #fff; }
.dlt-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.dlt-btn:focus-visible { outline: 3px solid rgba(0, 115, 230, .35); outline-offset: 2px; }

.dlt-btn-ghost {
	background: #fff;
	color: var(--dlt-blue-dark);
	border: 1.5px solid var(--dlt-line);
	box-shadow: none;
	flex: 0 1 auto;
}

.dlt-btn-ghost:hover:not(:disabled) { background: var(--dlt-soft); color: var(--dlt-blue-dark); box-shadow: none; }

.dlt-spinner {
	width: 17px;
	height: 17px;
	border: 2.5px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: dlt-spin .7s linear infinite;
}

@keyframes dlt-spin { to { transform: rotate(360deg); } }

/* ===== الرسائل ===== */

.dlt-error {
	margin: 14px 0 0;
	padding: 12px 15px;
	border-radius: 10px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
	font-size: .9rem;
	line-height: 1.8;
}

.dlt-note {
	margin: 16px 0 0;
	padding: 13px 16px;
	border-radius: 10px;
	background: var(--dlt-soft);
	border-inline-start: 3px solid var(--dlt-blue);
	color: var(--dlt-muted);
	font-size: .83rem;
	line-height: 1.9;
}

.dlt-note strong { color: var(--dlt-ink); }

/* ===== النتائج ===== */

.dlt-result { margin-top: 18px; animation: dlt-rise .3s ease both; }

@keyframes dlt-rise {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: none; }
}

.dlt-result-title {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 16px;
	font-size: 1.1rem;
	font-weight: 800;
}

.dlt-result-title::before {
	content: "";
	width: 4px;
	height: 20px;
	border-radius: 4px;
	background: var(--dlt-blue);
	flex: none;
}

.dlt-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 12px;
}

.dlt-stat {
	padding: 16px;
	border: 1px solid var(--dlt-line);
	border-radius: 12px;
	background: var(--dlt-soft);
}

.dlt-stat span { display: block; font-size: .82rem; color: var(--dlt-muted); margin-bottom: 6px; line-height: 1.6; }
.dlt-stat b { display: block; font-size: 1.25rem; font-weight: 800; line-height: 1.4; }
.dlt-stat small { display: block; margin-top: 4px; font-size: .76rem; color: var(--dlt-muted); }

.dlt-stat.is-ok b { color: var(--dlt-ok); }
.dlt-stat.is-bad b { color: var(--dlt-bad); }
.dlt-stat.is-blue b { color: var(--dlt-blue-dark); }

/* صفوف التفصيل */

.dlt-rows { list-style: none; margin: 16px 0 0; padding: 0; border: 1px solid var(--dlt-line); border-radius: 12px; overflow: hidden; }

.dlt-rows li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin: 0;
	padding: 13px 16px;
	font-size: .92rem;
	line-height: 1.7;
}

.dlt-rows li + li { border-top: 1px solid var(--dlt-line); }
.dlt-rows li:nth-child(odd) { background: var(--dlt-soft); }
.dlt-rows li > span { color: var(--dlt-muted); min-width: 0; }
.dlt-rows li > b { font-weight: 800; white-space: nowrap; }
.dlt-rows li.is-minus > b { color: var(--dlt-bad); }
.dlt-rows li.is-plus > b { color: var(--dlt-ok); }

/* الإجمالي */

.dlt-total {
	margin-top: 16px;
	padding: 22px;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--dlt-blue-dark) 0%, var(--dlt-blue) 100%);
	color: #fff;
	text-align: center;
	box-shadow: 0 8px 26px rgba(10, 79, 163, .24);
}

.dlt-total-label { display: block; font-size: .88rem; opacity: .88; margin-bottom: 8px; }
.dlt-total-value { display: block; font-size: 2.1rem; font-weight: 800; line-height: 1.3; letter-spacing: -.5px; }
.dlt-total-value small { font-size: .95rem; font-weight: 700; opacity: .85; margin-inline-start: 6px; }

.dlt-total-words {
	margin: 14px 0 0;
	padding-top: 14px;
	border-top: 1px solid rgba(255, 255, 255, .22);
	font-size: .88rem;
	line-height: 1.9;
	opacity: .95;
}

/* ===== الشارات ===== */

.dlt-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border-radius: 999px;
	font-size: .92rem;
	font-weight: 800;
	line-height: 1.5;
}

.dlt-badge-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }

.dlt-badge.t-green { background: #dcfce7; color: #15803d; }
.dlt-badge.t-blue { background: #dbeafe; color: #1d4ed8; }
.dlt-badge.t-amber { background: #fef3c7; color: #b45309; }
.dlt-badge.t-gray { background: #eef1f5; color: #475569; }
.dlt-badge.t-red { background: #fee2e2; color: #b91c1c; }

.dlt-badge-wrap { margin-top: 16px; text-align: center; }
.dlt-badge-wrap p { margin: 10px 0 0; font-size: .86rem; color: var(--dlt-muted); line-height: 1.9; }

/* ===== الخطاب التعريفي ===== */

.dlt-letter { margin-top: 18px; }

.dlt-letter textarea {
	min-height: 380px;
	padding: 22px;
	border-radius: 12px;
	background: #fffdf7;
	border-color: #eadfc4;
	font-size: 1rem;
	line-height: 2.1;
}

.dlt-letter textarea[dir="ltr"] { text-align: left; }

.dlt-letter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
}

.dlt-letter-bar h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.dlt-letter-tools { display: flex; gap: 8px; }

.dlt-mini {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 15px;
	border: 1.5px solid var(--dlt-line);
	border-radius: 999px;
	background: #fff;
	color: var(--dlt-ink);
	font-family: inherit;
	font-size: .84rem;
	font-weight: 700;
	cursor: pointer;
	transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.dlt-mini:hover { background: var(--dlt-soft); border-color: var(--dlt-blue); color: var(--dlt-blue-dark); }
.dlt-mini.is-done { background: #dcfce7; border-color: #86efac; color: #15803d; }
.dlt-mini svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* قفل جمع البيانات */

.dlt-lock {
	margin-top: 18px;
	padding: 30px 24px;
	border: 2px dashed var(--dlt-line);
	border-radius: var(--dlt-r);
	background: var(--dlt-soft);
	text-align: center;
}

.dlt-lock svg { width: 40px; height: 40px; stroke: var(--dlt-blue); fill: none; stroke-width: 1.8; margin-bottom: 12px; }
.dlt-lock h3 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 800; }
.dlt-lock p { margin: 0 0 18px; color: var(--dlt-muted); font-size: .92rem; line-height: 1.9; }
.dlt-lock .dlt-btn { flex: 0 1 auto; }

.dlt-preview {
	position: relative;
	max-height: 170px;
	overflow: hidden;
	padding: 20px;
	border: 1px solid var(--dlt-line);
	border-radius: 12px;
	background: #fffdf7;
	font-size: .95rem;
	line-height: 2.1;
	white-space: pre-wrap;
	color: var(--dlt-ink);
}

.dlt-preview::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	height: 90px;
	background: linear-gradient(to bottom, rgba(255, 253, 247, 0), #fffdf7 88%);
}

/* ===== النافذة المنبثقة ===== */

.dlt-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	background: rgba(10, 20, 32, .62);
	backdrop-filter: blur(3px);
	animation: dlt-fade .2s ease both;
}

@keyframes dlt-fade { from { opacity: 0; } to { opacity: 1; } }

.dlt-modal-box {
	position: relative;
	width: 100%;
	max-width: 430px;
	max-height: 92vh;
	overflow-y: auto;
	padding: 30px 26px 26px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
	animation: dlt-rise .25s ease both;
}

.dlt-modal-box h3 { margin: 0 0 8px; font-size: 1.2rem; font-weight: 800; }
.dlt-modal-box > p { margin: 0 0 20px; color: var(--dlt-muted); font-size: .9rem; line-height: 1.9; }
.dlt-modal-box form { display: flex; flex-direction: column; gap: 14px; }
.dlt-modal-box label { display: flex; flex-direction: column; gap: 7px; font-size: .88rem; font-weight: 700; }

.dlt-modal-close {
	position: absolute;
	top: 12px;
	inset-inline-start: 14px;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: var(--dlt-soft);
	color: var(--dlt-muted);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.dlt-modal-close:hover { background: #e8edf3; color: var(--dlt-ink); }

/* ===== معرض النماذج ===== */

.dlt-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; justify-content: center; }

.dlt-chip {
	padding: 9px 20px;
	border: 1.5px solid var(--dlt-line);
	border-radius: 999px;
	background: #fff;
	color: var(--dlt-muted);
	font-family: inherit;
	font-size: .88rem;
	font-weight: 700;
	cursor: pointer;
	transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.dlt-chip:hover { border-color: var(--dlt-blue); color: var(--dlt-blue-dark); }
.dlt-chip.is-on { background: var(--dlt-blue); border-color: var(--dlt-blue); color: #fff; }

.dlt-tpl-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
	gap: 20px;
}

.dlt-tpl {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--dlt-line);
	border-radius: var(--dlt-r);
	background: #fff;
	overflow: hidden;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.dlt-tpl:hover { transform: translateY(-4px); border-color: rgba(0, 115, 230, .35); box-shadow: 0 12px 30px rgba(20, 32, 46, .12); }
.dlt-tpl[hidden] { display: none; }

.dlt-tpl-thumb {
	position: relative;
	aspect-ratio: 3 / 4;
	background: var(--dlt-soft);
	overflow: hidden;
}

.dlt-tpl-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }

.dlt-tpl-thumb .dlt-tpl-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #c3cedb;
}

.dlt-tpl-thumb .dlt-tpl-empty svg { width: 54px; height: 54px; stroke: currentColor; fill: none; stroke-width: 1.4; }

.dlt-tpl-tag {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	padding: 5px 13px;
	border-radius: 999px;
	background: rgba(10, 79, 163, .92);
	color: #fff;
	font-size: .74rem;
	font-weight: 800;
	backdrop-filter: blur(4px);
}

.dlt-tpl-body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 16px; }
.dlt-tpl-body h3 { margin: 0; font-size: 1rem; font-weight: 800; line-height: 1.6; }
.dlt-tpl-body p { margin: 0; flex: 1; color: var(--dlt-muted); font-size: .84rem; line-height: 1.85; }

.dlt-tpl-dl { display: flex; gap: 8px; margin-top: 6px; }

.dlt-dl {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 1;
	padding: 11px 12px;
	border-radius: 10px;
	background: var(--dlt-blue);
	color: #fff !important;
	font-size: .85rem;
	font-weight: 800;
	text-decoration: none !important;
	transition: background .16s ease;
}

.dlt-dl:hover { background: var(--dlt-blue-dark); color: #fff !important; }
.dlt-dl.is-word { background: #1e5aa8; }
.dlt-dl.is-word:hover { background: #164680; }
.dlt-dl svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.dlt-empty {
	padding: 46px 22px;
	border: 2px dashed var(--dlt-line);
	border-radius: var(--dlt-r);
	text-align: center;
	color: var(--dlt-muted);
	line-height: 1.9;
}

/* ===== الأسئلة الشائعة ===== */

.dlt-faq { margin-top: 30px; }
.dlt-faq h2 { margin: 0 0 16px; font-size: 1.25rem; font-weight: 800; }

.dlt-faq details {
	border: 1px solid var(--dlt-line);
	border-radius: 12px;
	background: #fff;
	margin-bottom: 10px;
	overflow: hidden;
}

.dlt-faq summary {
	padding: 15px 18px;
	font-size: .95rem;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.dlt-faq summary::-webkit-details-marker { display: none; }

.dlt-faq summary::after {
	content: "+";
	flex: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--dlt-soft);
	color: var(--dlt-blue);
	font-size: 1.1rem;
	font-weight: 800;
	line-height: 23px;
	text-align: center;
}

.dlt-faq details[open] summary::after { content: "\2212"; }
.dlt-faq details[open] summary { border-bottom: 1px solid var(--dlt-line); }
.dlt-faq details p { margin: 0; padding: 15px 18px; color: var(--dlt-muted); font-size: .9rem; line-height: 2; }

/* ===== إخفاء ===== */

.dlt [hidden] { display: none !important; }
.dlt-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* ===== الجوال ===== */

@media (max-width: 640px) {
	.dlt-card { padding: 18px 16px; }
	.dlt-grid,
	.dlt-grid-3 { grid-template-columns: 1fr; gap: 14px; }
	.dlt-dur { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
	.dlt-head h1, .dlt-head h2 { font-size: 1.3rem; }
	.dlt-total-value { font-size: 1.7rem; }
	.dlt-btn { flex: 1 1 100%; }
	.dlt-seg label { font-size: .84rem; padding: 9px 5px; }
	.dlt-tpl-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
	.dlt-tpl-body { padding: 13px; }
	.dlt-letter textarea { padding: 16px; min-height: 320px; }
}

/* ===== تفضيلات الحركة والطباعة ===== */

@media (prefers-reduced-motion: reduce) {
	.dlt *, .dlt *::before, .dlt *::after {
		animation-duration: .001ms !important;
		transition-duration: .001ms !important;
	}
}

@media print {
	.dlt-actions, .dlt-filters, .dlt-modal, .dlt-faq, .dlt-lock { display: none !important; }
	.dlt-card { border: none; box-shadow: none; padding: 0; }
	.dlt-total { background: none !important; color: #000 !important; border: 2px solid #000; }
}
