.mai {
	--mai-bg: #ffffff;
	--mai-surface: #f6f7f9;
	--mai-border: #dde1e6;
	--mai-text: #1d2127;
	--mai-muted: #4b5563; /* أغمق لوضوح أفضل على الشاشات الصغيرة والإضاءة القوية */
	--mai-accent: #0f766e;
	--mai-accent-text: #ffffff;
	--mai-review: #fdf8ec;
	--mai-review-border: #e8d9ad;
	--mai-error: #b42318;
	--mai-fs: 17px;
	/* حجم نصوص الواجهة الثابتة: يتبع حجم الخط الذي يختاره المستخدم */
	--mai-ui: max(15px, calc(var(--mai-fs) - 1px));
	--mai-ui-sm: max(14px, calc(var(--mai-fs) - 3px));
	color: var(--mai-text);
	font-size: var(--mai-ui);
	line-height: 1.7;
	/* يتجاوز عرض القالب الضيق: عرض كامل حتى 1400px مع هامش 16px على الجوال */
	--mai-w: min(1400px, calc(100vw - 32px));
	position: relative;
}
/* تخطّي قيود عرض المحتوى في قوالب ووردبريس (constrained layout) */
#mai-app.mai {
	width: var(--mai-w) !important;
	max-width: none !important;
	margin-left: calc((100% - var(--mai-w)) / 2) !important;
	margin-right: calc((100% - var(--mai-w)) / 2) !important;
}

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

.mai-grid {
	display: grid;
	gap: 16px;
}
/* أربعة صناديق في صفين (2×2)، ومراجِعان في صف واحد */
.mai-generators,
.mai-reviewers { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* الجوال والشاشات الضيقة: عمود واحد */
@media (max-width: 760px) {
	.mai-generators, .mai-reviewers { grid-template-columns: 1fr; gap: 12px; }
}

.mai-box {
	background: var(--mai-bg);
	border: 1px solid var(--mai-border);
	border-radius: 10px;
	display: flex;
	flex-direction: column;
	min-height: 280px;
	overflow: hidden;
}
.mai-review-box {
	background: var(--mai-review);
	border-color: var(--mai-review-border);
	min-height: 300px;
}

.mai-box-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-bottom: 1px solid var(--mai-border);
	background: var(--mai-surface);
}
.mai-review-box .mai-box-head { background: transparent; border-color: var(--mai-review-border); }

.mai-model {
	flex: 1;
	min-width: 0;
	padding: 6px 8px;
	border: 1px solid var(--mai-border);
	border-radius: 6px;
	min-height: 36px;
	background: var(--mai-bg);
	font: inherit;
	font-size: var(--mai-ui);
}
.mai-tag { font-weight: 600; font-size: calc(var(--mai-ui) + 1px); white-space: nowrap; }
.mai-meta { font-size: var(--mai-ui-sm); color: var(--mai-muted); white-space: nowrap; }

.mai-output {
	padding: 12px;
	overflow: auto;
	max-height: 560px;
	flex: 1;
	word-wrap: break-word;
	font-size: var(--mai-fs);
	line-height: 1.8;
}
.mai-output pre {
	direction: ltr;
	text-align: left;
	background: #1f2933;
	color: #e5e7eb;
	padding: 10px;
	border-radius: 6px;
	overflow-x: auto;
	font-size: 0.82em;
}
.mai-output code { font-size: 0.92em; }
.mai-h { display: block; margin-top: 6px; font-size: 1.05em; }
.mai-placeholder { color: var(--mai-muted); font-size: 0.9em; }
.mai-key {
	font-size: var(--mai-ui-sm);
	color: var(--mai-muted);
	border-bottom: 1px dashed var(--mai-review-border);
	padding-bottom: 6px;
	margin-bottom: 8px;
}

.mai-box.is-error .mai-output { color: var(--mai-error); }

.mai-prompt {
	margin: 14px 0;
	border: 2px solid var(--mai-accent);
	border-radius: 12px;
	padding: 10px;
	background: var(--mai-bg);
}
.mai-prompt textarea {
	width: 100%;
	border: 0;
	resize: vertical;
	font: inherit;
	background: transparent;
	color: var(--mai-text);
	outline: none;
	font-size: var(--mai-fs);
}
.mai-prompt-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}
.mai-check { font-size: var(--mai-ui); display: flex; align-items: center; gap: 4px; }
.mai-total { flex: 1; font-size: var(--mai-ui-sm); color: var(--mai-muted); }
.mai-btn {
	background: var(--mai-accent);
	color: var(--mai-accent-text);
	border: 0;
	border-radius: 8px;
	padding: 10px 32px;
	font: inherit;
	font-size: calc(var(--mai-ui) + 1px);
	font-weight: 600;
	cursor: pointer;
}
.mai-btn:disabled { opacity: 0.55; cursor: wait; }

.mai-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid var(--mai-border);
	border-top-color: var(--mai-accent);
	border-radius: 50%;
	animation: mai-spin 0.8s linear infinite;
	vertical-align: middle;
}
@keyframes mai-spin { to { transform: rotate(360deg); } }

.mai-notice {
	padding: 12px;
	border: 1px solid #dde1e6;
	border-radius: 8px;
	background: #f6f7f9;
}

/* ---------- الإجابة الموحّدة ---------- */
.mai-final-box {
	margin-top: 16px;
	border: 2px solid var(--mai-accent);
	background: #f0fbf9;
	min-height: 220px;
}
.mai-final-box .mai-box-head { background: var(--mai-accent); border-color: var(--mai-accent); }
.mai-final-box .mai-tag { color: #fff; font-size: calc(var(--mai-ui) + 1px); }
.mai-final-box .mai-meta { color: #d7f3ee; }
.mai-final-box .mai-output { max-height: none; font-size: calc(var(--mai-fs) + 1px); line-height: 1.9; }

/* ---------- زر النسخ ---------- */
.mai-copy {
	border: 1px solid var(--mai-border);
	background: var(--mai-bg);
	color: var(--mai-text);
	border-radius: 6px;
	padding: 4px 12px;
	font: inherit;
	font-size: var(--mai-ui-sm);
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	min-height: 32px;
}
.mai-copy:hover { border-color: var(--mai-accent); color: var(--mai-accent); }
.mai-box-tools { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.mai-box-tools[hidden] { display: none; }

/* ---------- الجوال ---------- */
@media (max-width: 760px) {
	/* على الجوال: مربع الطلب أولاً، ثم الإجابات، ثم المراجعة */
	#mai-app.mai { display: flex; flex-direction: column; gap: 12px; }
	.mai-prompt { order: -2; margin: 0 !important; }
	.mai-final-box { order: -1; margin-top: 0; }

	.mai-box, .mai-review-box { min-height: 0; }
	.mai-output { max-height: 420px; padding: 10px; }
	.mai-box-head { flex-wrap: wrap; }
	.mai-model { font-size: max(16px, var(--mai-ui)); padding: 8px; min-height: 42px; flex: 1 1 calc(100% - 100px); }
	.mai-meta { margin-inline-end: auto; } /* 16px يمنع التكبير التلقائي في iOS */
	.mai-prompt { margin: 12px 0; }
	.mai-prompt textarea { font-size: max(16px, var(--mai-fs)); }
	.mai-prompt-bar { gap: 8px; }
	.mai-total { order: 3; flex-basis: 100%; }
	.mai-btn { flex: 1; padding: 12px; min-height: 44px; }
}

.mai-warn {
	margin-top: 10px;
	padding: 6px 10px;
	border-radius: 6px;
	background: #fff7e6;
	color: #8a5a00;
	font-size: var(--mai-ui-sm);
}

.mai-more {
	margin-inline-start: 8px;
	border: 1px solid #c98a00;
	background: #fff;
	color: #8a5a00;
	border-radius: 6px;
	padding: 2px 10px;
	font: inherit;
	font-size: var(--mai-ui-sm);
	cursor: pointer;
}
.mai-more:hover { background: #fff1d6; }
.mai-cont { margin-top: 8px; color: var(--mai-muted); font-size: var(--mai-ui-sm); }

/* ---------- درجة الثقة وخريطة الاتفاق ---------- */
.mai-conf {
	margin: 0 0 12px;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 0.88em;
}
.mai-conf-high { background: #e6f6ee; color: #11643d; border: 1px solid #a9dfc2; }
.mai-conf-mid  { background: #fff7e6; color: #8a5a00; border: 1px solid #f0d49a; }
.mai-conf-low  { background: #fdecec; color: #a12622; border: 1px solid #f2b8b5; }
.mai-map {
	margin-top: 16px;
	padding: 12px 14px;
	border: 1px dashed var(--mai-accent);
	border-radius: 10px;
	background: #fff;
	font-size: 0.9em;
}
.mai-map-title { font-weight: 700; color: var(--mai-accent); margin-bottom: 6px; }
.mai-li { display: inline-block; padding-inline-start: 6px; }

/* ---------- شريط الأدوات ---------- */
.mai-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 28px;
	margin-bottom: 14px;
	padding: 8px 10px;
	border: 1px solid var(--mai-border);
	border-radius: 10px;
	background: var(--mai-surface);
}
.mai-tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mai-tool-label { font-size: var(--mai-ui-sm); color: var(--mai-muted); }
.mai-tool {
	border: 1px solid var(--mai-border);
	background: var(--mai-bg);
	color: var(--mai-text);
	border-radius: 8px;
	padding: 6px 14px;
	font: inherit;
	font-size: var(--mai-ui);
	font-weight: 500;
	cursor: pointer;
	min-height: 40px;
}
.mai-tool:hover:not(:disabled) { border-color: var(--mai-accent); color: var(--mai-accent); }
.mai-tool:disabled { opacity: 0.5; cursor: not-allowed; }
.mai-tool-danger:hover:not(:disabled) { border-color: var(--mai-error); color: var(--mai-error); }
.mai-font-val { min-width: 28px; font-weight: 600; text-align: center; font-size: var(--mai-ui-sm); color: var(--mai-muted); }

/* ---------- إرفاق الملفات ---------- */
.mai-attach {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: var(--mai-ui);
	padding: 6px 12px;
	border: 1px dashed var(--mai-accent);
	border-radius: 8px;
	color: var(--mai-accent);
	cursor: pointer;
}
.mai-attach:hover { background: #f0fbf9; }
.mai-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mai-attach:focus-within { outline: 2px solid var(--mai-accent); outline-offset: 2px; }
.mai-files { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 8px; }
.mai-files[hidden] { display: none; }
.mai-file {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: var(--mai-ui-sm);
	padding: 4px 6px 4px 10px;
	border-radius: 999px;
	background: var(--mai-surface);
	border: 1px solid var(--mai-border);
	max-width: 100%;
}
.mai-file small { color: var(--mai-muted); }
.mai-file.is-error { border-color: #f2b8b5; background: #fdecec; color: var(--mai-error); }
.mai-file button { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--mai-muted); padding: 0 4px; }
.mai-files-hint { font-size: var(--mai-ui-sm); color: var(--mai-muted); flex-basis: 100%; }

/* ---------- تصدير صندوق ---------- */
.mai-exp { position: relative; }
.mai-exp[hidden] { display: none; }
.mai-exp summary {
	list-style: none;
	border: 1px solid var(--mai-border);
	background: var(--mai-bg);
	border-radius: 6px;
	padding: 4px 12px;
	font-size: var(--mai-ui-sm);
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	min-height: 32px;
	display: inline-flex;
	align-items: center;
}
.mai-exp summary::-webkit-details-marker { display: none; }
.mai-exp summary:hover { border-color: var(--mai-accent); color: var(--mai-accent); }
.mai-final-box .mai-exp summary, .mai-final-box .mai-copy { background: rgba(255,255,255,.95); }
.mai-exp-menu {
	position: absolute;
	inset-inline-end: 0;
	top: calc(100% + 4px);
	z-index: 20;
	display: flex;
	flex-direction: column;
	min-width: 96px;
	background: var(--mai-bg);
	border: 1px solid var(--mai-border);
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(0,0,0,.12);
	overflow: hidden;
}
.mai-exp-menu button { border: 0; background: transparent; padding: 8px 12px; font: inherit; font-size: var(--mai-ui); text-align: start; cursor: pointer; color: var(--mai-text); }
.mai-exp-menu button:hover { background: var(--mai-surface); color: var(--mai-accent); }

@media (max-width: 760px) {
	.mai-stick { order: -3; }
	.mai-tool { min-height: 40px; }
	.mai-attach { min-height: 44px; }
}

/* عنوان الصفحة في الوسط */
body:has(#mai-app) .wp-block-post-title,
body:has(#mai-app) h1.entry-title,
body:has(#mai-app) .page-title { text-align: center !important; }

/* الجداول في الردود */
.mai-table-wrap { overflow-x: auto; margin: 8px 0; }
.mai-table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
.mai-table th, .mai-table td { border: 1px solid var(--mai-border); padding: 6px 10px; text-align: start; vertical-align: top; }
.mai-table th { background: var(--mai-surface); font-weight: 600; }
.mai-table tr:nth-child(even) td { background: #fafbfc; }

.mai-toolbar-bottom { margin: 16px 0 0; justify-content: center; }
@media (max-width: 760px) { .mai-toolbar-bottom { order: 5; } }

/* محاذاة الأيقونة والنص في وسط الأزرار */
.mai-tool, .mai-copy, .mai-btn, .mai-attach { display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; text-align: center; }
.mai-tool-group { justify-content: center; }
.mai-btn-stop { background: var(--mai-error); }
.mai-btn-stop[hidden] { display: none; }
.mai-prompt.is-drop { border-style: dashed; background: #f0fbf9; }

/* البحث في الإنترنت */
.mai-search-box { margin-bottom: 16px; min-height: 0; border-color: #b9d7f5; background: #f5f9ff; }
.mai-search-box[hidden] { display: none; }
.mai-search-box .mai-box-head { background: #e8f1fd; border-color: #b9d7f5; }
.mai-search-box .mai-output { max-height: 320px; font-size: calc(var(--mai-fs) - 1px); }
.mai-output a { color: var(--mai-accent); text-decoration: underline; word-break: break-all; }
.mai-sources { margin-top: 10px; font-size: 0.9em; }
.mai-sources ol { margin: 4px 0 0; padding-inline-start: 22px; }

.mai-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; vertical-align: middle; }

/* وضع الصور */
.mai.is-imgmode .mai-reviewers,
.mai.is-imgmode .mai-final-box,
.mai.is-imgmode .mai-search-box,
.mai.is-imgmode #mai-review-on, .mai.is-imgmode #mai-final-on, .mai.is-imgmode #mai-web-mode { display: none !important; }
.mai.is-imgmode .mai-check:has(#mai-review-on), .mai.is-imgmode .mai-check:has(#mai-final-on), .mai.is-imgmode .mai-check:has(#mai-web-mode), .mai.is-imgmode .mai-google { display: none; }
.mai-gen-fig { margin: 0 0 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.mai-gen-img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--mai-border); }
.mai-mic.is-on { background: #fdecec; border-color: var(--mai-error); color: var(--mai-error); }
.mai-mic[hidden] { display: none; }
.mai-imgmode { font-weight: 600; }

/* هوية Tetrova أعلى الأداة */
.mai-brand { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 16px; direction: ltr; }
.mai-brand-logo { height: 46px; width: auto; }
.mai-brand-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.mai-brand-name { font-size: 34px; font-weight: 700; color: #121A33; letter-spacing: -0.5px; }
.mai-brand-tag { font-size: var(--mai-ui-sm); color: var(--mai-muted); unicode-bidi: plaintext; }
/* عنوان الصفحة في ووردبريس يُخفى في صفحة الأداة لأن الهوية أعلاها تحل محله */
body:has(#mai-app) .wp-block-post-title, body:has(#mai-app) h1.entry-title { display: none !important; }
@media (max-width: 760px) { .mai-brand { order: -4; margin: 0; } .mai-brand-logo { height: 36px; width: auto; } .mai-brand-name { font-size: 26px; } }

/* مواصلة المحادثة مع الإجابة الموحّدة */
.mai-followup { border-top: 1px solid var(--mai-border); padding: 14px 16px 16px; background: #f4fbfa; }
.mai-thread { display: flex; flex-direction: column; gap: 12px; }
.mai-thread:not(:empty) { margin-bottom: 14px; }
.mai-turn-user { align-self: flex-start; max-width: 85%; }
.mai-turn-q {
	background: var(--mai-accent);
	color: var(--mai-accent-text);
	padding: 8px 14px;
	border-radius: 14px;
	border-end-start-radius: 4px;
	white-space: pre-wrap;
	font-size: var(--mai-fs);
	line-height: 1.7;
}
.mai-turn-ai { background: var(--mai-bg); border: 1px solid var(--mai-border); border-radius: 10px; }
.mai-turn-head { display: flex; gap: 10px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--mai-border); font-size: var(--mai-ui-sm); }
.mai-turn-label { font-weight: 700; color: var(--mai-accent); }
.mai-turn-ai .mai-meta { color: var(--mai-muted); margin-inline-start: auto; }
.mai-turn-ai .mai-output { padding: 10px 14px; max-height: none; font-size: var(--mai-fs); line-height: 1.9; }
.mai-turn-ai.is-error .mai-output { color: var(--mai-error); }
.mai-follow-bar { display: flex; gap: 10px; align-items: flex-end; }
.mai-follow-bar textarea {
	flex: 1;
	min-height: 52px;
	max-height: 220px;
	resize: vertical;
	border: 2px solid var(--mai-accent);
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	font-size: var(--mai-fs);
	background: var(--mai-bg);
	color: var(--mai-text);
}
.mai-follow-bar textarea:focus { outline: 3px solid rgba(15, 118, 110, .2); }
@media (max-width: 640px) {
	.mai-turn-user { max-width: 100%; }
	.mai-follow-bar { flex-direction: column; align-items: stretch; }
}

/* تبديل اللغة */
.mai-brand { position: relative; }
.mai-langs { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: inline-flex; border: 1px solid var(--mai-border); border-radius: 999px; overflow: hidden; background: var(--mai-bg); }
.mai-lang { border: 0; background: transparent; padding: 6px 14px; font: inherit; font-size: var(--mai-ui-sm); color: var(--mai-muted); cursor: pointer; min-height: 34px; }
.mai-lang + .mai-lang { border-left: 1px solid var(--mai-border); }
.mai-lang.is-on { background: var(--mai-accent); color: var(--mai-accent-text); font-weight: 600; cursor: default; }
.mai-lang:not(.is-on):hover { background: var(--mai-surface); color: var(--mai-text); }
@media (max-width: 760px) {
	.mai-brand { flex-wrap: wrap; }
	.mai-langs { position: static; transform: none; }
}

/* سجل المحادثات */
.mai-tool-strong { font-weight: 600; }
.mai-hist-backdrop { position: fixed; inset: 0; background: rgba(18, 26, 51, .28); z-index: 99998; }
.mai-hist {
	position: fixed; top: 0; bottom: 0; inset-inline-end: 0;
	width: min(400px, 100vw); z-index: 99999;
	background: var(--mai-bg); border-inline-start: 1px solid var(--mai-border);
	box-shadow: 0 0 24px rgba(18, 26, 51, .18);
	display: flex; flex-direction: column; gap: 10px; padding: 14px;
}
.mai-hist[hidden], .mai-hist-backdrop[hidden] { display: none; }
body.admin-bar .mai-hist { top: 32px; }
@media (max-width: 782px) { body.admin-bar .mai-hist { top: 46px; } }
.mai-hist-head { display: flex; align-items: center; justify-content: space-between; font-size: calc(var(--mai-ui) + 1px); }
.mai-hist-q { width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--mai-border); border-radius: 8px; font: inherit; font-size: var(--mai-ui); }
.mai-hist-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 0 -4px; padding: 0 4px; }
.mai-hist-item { display: flex; align-items: stretch; gap: 4px; border: 1px solid var(--mai-border); border-radius: 8px; background: var(--mai-bg); }
.mai-hist-item:hover { border-color: var(--mai-accent); }
.mai-hist-item.is-current { border-color: var(--mai-accent); background: #f4fbfa; }
.mai-hist-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: start; background: transparent; border: 0; padding: 9px 10px; cursor: pointer; font: inherit; color: var(--mai-text); }
.mai-hist-open.is-loading { opacity: .5; cursor: progress; }
.mai-hist-title { font-size: var(--mai-ui); font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: start; }
.mai-hist-meta { font-size: var(--mai-ui-sm); color: var(--mai-muted); }
.mai-hist-del { flex: none; border: 0; background: transparent; color: var(--mai-muted); cursor: pointer; padding: 0 10px; border-radius: 0; border-start-end-radius: 8px; border-end-end-radius: 8px; font: inherit; font-size: var(--mai-ui-sm); min-width: 40px; }
.mai-hist-del:hover, .mai-hist-del.is-confirm { color: #fff; background: var(--mai-error); }
.mai-hist-empty { color: var(--mai-muted); text-align: center; padding: 30px 10px; }
.mai-hist-empty.is-error { color: var(--mai-error); }
.mai-hist-more { align-self: center; margin: 6px 0; }
.mai-hist-foot { border-top: 1px solid var(--mai-border); padding-top: 10px; text-align: center; }
.mai-tool.is-confirm { border-color: var(--mai-error); color: #fff; background: var(--mai-error); }

/* شريط «محادثة محفوظة» */
.mai-viewing { border: 1px solid var(--mai-accent); background: #f4fbfa; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
.mai-viewing[hidden] { display: none; }
.mai-viewing-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--mai-accent); }
.mai-viewing-q { margin-top: 6px; font-size: var(--mai-fs); white-space: pre-wrap; max-height: 9em; overflow: auto; }
.mai-viewing-files { margin-top: 4px; font-size: var(--mai-ui-sm); color: var(--mai-muted); }
@media (max-width: 760px) { .mai-viewing { order: -1; } }

/* عمق الإجابة */
.mai-depth-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 2px; }
.mai-depth { display: inline-flex; border: 1px solid var(--mai-border); border-radius: 999px; overflow: hidden; background: var(--mai-bg); }
.mai-depth-btn { border: 0; background: transparent; padding: 7px 16px; font: inherit; font-size: var(--mai-ui); color: var(--mai-text); cursor: pointer; min-height: 38px; }
.mai-depth-btn + .mai-depth-btn { border-inline-start: 1px solid var(--mai-border); }
.mai-depth-btn.is-on { background: var(--mai-accent); color: var(--mai-accent-text); font-weight: 600; }
.mai-depth-btn:not(.is-on):hover { background: var(--mai-surface); }
.mai-depth-hint {
	flex: 1 1 260px;
	font-size: var(--mai-ui);
	font-weight: 500;
	line-height: 1.6;
	color: var(--mai-text);
	background: #eef7f5;
	border-inline-start: 4px solid var(--mai-accent);
	border-radius: 8px;
	padding: 7px 12px;
}
.mai.is-fast:not(.is-imgmode) [data-role="gen"][data-index="2"],
.mai.is-fast:not(.is-imgmode) [data-role="gen"][data-index="3"] { opacity: .45; }
@media (max-width: 640px) { .mai-depth { width: 100%; } .mai-depth-btn { flex: 1; padding: 9px 6px; min-height: 44px; } .mai-depth-hint { flex-basis: 100%; } }

/* شريط السؤال على الجوال: أهداف لمس أكبر وترتيب أوضح */
@media (max-width: 640px) {
	.mai-prompt-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
	.mai-prompt-bar .mai-web { grid-column: 1 / -1; }
	.mai-prompt-bar .mai-web select { flex: 1; width: 100%; min-width: 0; }
	.mai-prompt-bar .mai-google { justify-content: center; }
	.mai-prompt-bar .mai-attach { width: 100%; box-sizing: border-box; }
	.mai-prompt-bar .mai-check {
		min-height: 44px; box-sizing: border-box; padding: 6px 10px;
		border: 1px solid var(--mai-border); border-radius: 10px; background: var(--mai-bg);
		font-size: var(--mai-ui-sm); line-height: 1.3;
	}
	.mai-prompt-bar .mai-check input { width: 20px; height: 20px; flex: none; margin: 0 2px; accent-color: var(--mai-accent); }
	.mai-prompt-bar .mai-check[hidden], .mai-prompt-bar .mai-mic[hidden] { display: none; }
	.mai-prompt-bar .mai-total { grid-column: 1 / -1; text-align: center; }
	.mai-prompt-bar .mai-btn { grid-column: 1 / -1; min-height: 50px; font-size: calc(var(--mai-ui) + 2px); }
}

/* =====================================================================
   هوية Tetrova: ألوان فقاعات الشعار
   ===================================================================== */
.mai, .mai-intro, body.mai-shell {
	--t-ink: #121A33;
	--t-teal: #0F8B7D;
	--t-coral: #E8735A;
	--t-amber: #F5B83D;
	--t-blue: #4C7DF0;
	--t-mist: #F4F6FA;
	--t-line: #E3E7EE;
}
.mai, .mai-intro { font-family: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; }

/* كل صندوق بلون فقاعة من الشعار: الشعار نفسه خريطة للأداة */
.mai [data-role="gen"][data-index="0"] { --mai-c: var(--t-teal); }
.mai [data-role="gen"][data-index="1"] { --mai-c: var(--t-coral); }
.mai [data-role="gen"][data-index="2"] { --mai-c: var(--t-amber); }
.mai [data-role="gen"][data-index="3"] { --mai-c: var(--t-blue); }
.mai [data-role="gen"] { border-top: 4px solid var(--mai-c); }
.mai [data-role="gen"] .mai-tag::before {
	content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50% 50% 50% 2px;
	background: var(--mai-c); margin-inline-end: 7px; vertical-align: 1px;
}
/* الإجابة الموحّدة: الفقاعة الكحلية ذات النجمة */
.mai .mai-final-box { border-color: var(--t-ink); }
.mai .mai-final-box .mai-box-head { background: var(--t-ink); border-color: var(--t-ink); }
.mai .mai-final-box .mai-meta { color: #C9D1E3; }
.mai .mai-star { color: var(--t-amber); }
.mai .mai-final-box .mai-copy { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.mai .mai-final-box .mai-copy:hover { border-color: var(--t-amber); color: var(--t-amber); }

/* =====================================================================
   إطار التطبيق (الصفحة الرئيسية)
   ===================================================================== */
body.mai-shell { margin: 0; background: var(--t-mist); color: var(--t-ink); font-family: "Readex Pro", system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
body.mai-shell .mai-main { flex: 1; padding: 18px 0 28px; }
.mai-top, .mai-foot {
	--mai-bg: #ffffff; --mai-surface: #f6f7f9; --mai-border: #dde1e6; --mai-text: #1d2127;
	--mai-muted: #4b5563; --mai-accent: #0f766e; --mai-accent-text: #ffffff; --mai-ui-sm: 14px;
}
.mai-top { position: sticky; top: 0; z-index: 1000; background: #fff; border-bottom: 1px solid var(--t-line); font-family: "Readex Pro", system-ui, sans-serif; }
body.admin-bar .mai-top { top: 32px; }
@media (max-width: 782px) { body.admin-bar .mai-top { top: 46px; } }
@media (max-width: 600px) { body.admin-bar .mai-top { top: 0; } }
/* الشعار يساراً والأدوات يميناً في كل اللغات */
.mai-top-in { direction: ltr; max-width: 1400px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; min-height: 66px; box-sizing: border-box; }
.mai-top-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--t-ink); direction: ltr; }
.mai-top-brand img { height: 40px; width: auto; }
.mai-top-name { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.mai-top-tag { font-size: 15px; color: #4b5563; padding-left: 10px; border-left: 1px solid var(--t-line); unicode-bidi: plaintext; }
.mai-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mai-top-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--t-line);
	background: #fff; color: var(--t-ink); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.mai-top-btn:hover { border-color: var(--t-teal); color: var(--t-teal); }
.mai-top-btn:focus-visible, .mai-lang:focus-visible, .mai-hero-cta:focus-visible { outline: 3px solid rgba(15,139,125,.35); outline-offset: 2px; }
.mai-top-cta { background: var(--t-teal); border-color: var(--t-teal); color: #fff; }
.mai-top-cta:hover { background: #0c7368; color: #fff; }
.mai-top-langs { position: static; transform: none; }
.mai-top-langs .mai-lang { min-width: 44px; padding: 6px 10px; font-weight: 600; }
@media (max-width: 900px) { .mai-top-tag { display: none; } }
@media (max-width: 640px) {
	.mai-top-in { gap: 8px; padding: 6px 12px; }
	.mai-top-name { font-size: 24px; }
	.mai-top-brand img { height: 32px; }
	.mai-top-lbl { display: none; }
	.mai-top-btn { min-width: 44px; min-height: 44px; padding: 6px 10px; font-size: 18px; }
	.mai-top-cta { font-size: 15px; }
	.mai-top-langs .mai-lang { min-width: 40px; min-height: 40px; }
}
.mai-foot { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; padding: 18px 16px 26px; color: #4b5563; font-size: 14px; border-top: 1px solid var(--t-line); background: #fff; font-family: "Readex Pro", system-ui, sans-serif; }
.mai-foot a { color: var(--t-teal); text-decoration: none; direction: ltr; }
.mai-foot a:hover { text-decoration: underline; }

/* داخل الإطار: الصناديق بيضاء على خلفية فاتحة، وشريط الأدوات العلوي أخف */
.mai.in-shell .mai-toolbar:not(.mai-toolbar-bottom) { background: transparent; border: 0; padding: 0 0 12px; }
@media (max-width: 760px) {
	/* على الجوال: أدوات النسخ والتصدير في الأسفل فقط، ويبقى حجم الخط أعلى الصفحة */
	.mai.in-shell .mai-toolbar:not(.mai-toolbar-bottom) .mai-tool-group:has([data-act]) { display: none; }
	.mai.in-shell .mai-toolbar:not(.mai-toolbar-bottom) { padding: 0; }
}

/* =====================================================================
   صفحة التعريف (للزائر غير المسجّل)
   ===================================================================== */
.mai-intro { max-width: 1120px; margin: 0 auto; padding: 8px 16px 24px; color: var(--t-ink); }
.mai-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 36px 0 48px; }
.mai-hero h1 { font-size: clamp(30px, 4.6vw, 52px); line-height: 1.25; font-weight: 700; margin: 0 0 18px; letter-spacing: -0.5px; }
.mai-intro[dir="rtl"] .mai-hero h1 { letter-spacing: 0; line-height: 1.4; }
.mai-hero p { font-size: 19px; line-height: 1.8; color: #374151; margin: 0 0 26px; max-width: 34em; }
.mai-hero-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.mai-hero-cta { min-height: 52px; padding: 12px 30px; font-size: 18px; border-radius: 999px; text-decoration: none; background: var(--t-teal); }
.mai-hero-link { color: var(--t-ink); font-weight: 600; font-size: 17px; text-decoration: underline; text-decoration-color: var(--t-amber); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.mai-hero-note { font-size: 15px !important; color: #4b5563 !important; margin: 0 !important; }
.mai-hero-art { display: flex; justify-content: center; }
.mai-hero-art img { width: min(100%, 380px); height: auto; }

.mai-intro h2 { font-size: 26px; margin: 0 0 22px; font-weight: 700; }
.mai-how, .mai-modes { padding: 32px 0; border-top: 1px solid var(--t-line); }
.mai-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; counter-reset: step; }
.mai-step { display: flex; flex-direction: column; gap: 6px; counter-increment: step; position: relative; }
.mai-step strong { font-size: 19px; }
.mai-step strong::before { content: counter(step) ". "; color: #6b7280; font-weight: 500; }
.mai-step span:not(.mai-step-mark) { font-size: 16px; line-height: 1.7; color: #374151; }
.mai-step-mark { height: 30px; display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.mai-step-mark::before { content: ""; width: 26px; height: 20px; border-radius: 7px 7px 7px 2px; background: var(--t-teal); }
.mai-step-multi .mai-step-mark::before { width: 104px; background:
	linear-gradient(90deg, var(--t-teal) 0 22%, transparent 22% 26%, var(--t-coral) 26% 48%, transparent 48% 52%, var(--t-amber) 52% 74%, transparent 74% 78%, var(--t-blue) 78% 100%); border-radius: 6px; }
.mai-step-neutral .mai-step-mark::before { width: 56px; background: linear-gradient(90deg, #C9CFDA 0 46%, transparent 46% 54%, #C9CFDA 54% 100%); border-radius: 6px; }
.mai-step-navy .mai-step-mark::before { width: 40px; height: 28px; background: var(--t-ink); border-radius: 9px 9px 9px 2px; }
.mai-step-navy .mai-step-mark::after { content: "★"; color: var(--t-amber); position: absolute; inset-inline-start: 13px; top: 3px; font-size: 15px; }

.mai-mode-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.mai-mode-list li { background: #fff; border: 1px solid var(--t-line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.mai-mode-icon { font-size: 26px; }
.mai-mode-list strong { font-size: 19px; }
.mai-mode-list span:last-child { font-size: 16px; line-height: 1.7; color: #374151; }

@media (max-width: 900px) {
	.mai-hero { grid-template-columns: 1fr; gap: 20px; padding: 20px 0 32px; }
	.mai-hero-art { order: -1; }
	.mai-hero-art img { width: min(62vw, 240px); }
	.mai-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.mai-mode-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.mai-hero p { font-size: 17px; }
	.mai-steps { grid-template-columns: 1fr; gap: 18px; }
	.mai-hero-actions { flex-direction: column; align-items: stretch; text-align: center; }
	.mai-hero-cta { width: 100%; box-sizing: border-box; }
}
@media (prefers-reduced-motion: reduce) { .mai * { transition: none !important; animation: none !important; } }

/* الطلب اللاحق بعد وصول الإجابات */
.mai-upsell { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 14px 0 0; padding: 12px 14px; background: #fff; border: 1px dashed var(--t-teal, #0F8B7D); border-radius: 12px; }
.mai-upsell[hidden], .mai-up-btn[hidden] { display: none; }
.mai-upsell-text { font-size: var(--mai-ui); font-weight: 500; color: var(--mai-text); }
.mai-upsell-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mai-up-btn { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--mai-border); background: var(--mai-bg); color: var(--mai-text); font: inherit; font-size: var(--mai-ui); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.mai-up-btn:hover { border-color: var(--t-teal, #0F8B7D); color: var(--t-teal, #0F8B7D); }
.mai-up-btn:focus-visible { outline: 3px solid rgba(15,139,125,.35); outline-offset: 2px; }
.mai-up-main { background: var(--t-ink, #121A33); border-color: var(--t-ink, #121A33); color: #fff; }
.mai-up-main:hover { background: #1f2a4d; color: #fff; }
@media (max-width: 760px) {
	.mai-upsell { order: -1; margin: 0; }
	.mai-upsell-btns { width: 100%; }
	.mai-up-btn { flex: 1 1 100%; justify-content: center; }
}

/* مفتاح التمرير المتزامن */
.mai-sync { display: inline-flex; align-items: center; gap: 6px; font-size: var(--mai-ui-sm); color: var(--mai-text); cursor: pointer; padding: 6px 10px; border: 1px solid var(--mai-border); border-radius: 999px; background: var(--mai-bg); min-height: 40px; box-sizing: border-box; }
.mai-sync input { width: 18px; height: 18px; accent-color: var(--t-teal, #0F8B7D); margin: 0; }
@media (max-width: 760px) { .mai-sync { display: none; } }

/* شريط التمرير المشترك فوق كل مجموعة صناديق */
.mai-linkbar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 12px; background: var(--mai-bg); border: 1px solid var(--mai-border); border-radius: 999px; }
.mai-linkbar[hidden] { display: none; }
.mai-linkbar-label { font-size: var(--mai-ui-sm); font-weight: 600; color: var(--mai-text); white-space: nowrap; }
.mai-linkbar-range { direction: ltr; flex: 1; min-width: 80px; accent-color: var(--t-teal, #0F8B7D); cursor: pointer; height: 24px; }
.mai-linkbar-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--mai-border); background: var(--mai-bg); color: var(--mai-text); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.mai-linkbar-btn:hover { border-color: var(--t-teal, #0F8B7D); color: var(--t-teal, #0F8B7D); }
.mai-linkbar-btn:focus-visible, .mai-linkbar-range:focus-visible { outline: 3px solid rgba(15,139,125,.35); outline-offset: 2px; }
.mai-reviewers + .mai-linkbar, .mai-linkbar + .mai-reviewers { margin-top: 0; }
@media (max-width: 760px) { .mai-linkbar { display: none !important; } }
.mai-box.is-waiting .mai-placeholder { color: var(--mai-text); }

/* البحث في الإنترنت: قائمة بثلاث طرق، ورابط بحث Google */
.mai-web select { font: inherit; font-size: var(--mai-ui-sm, 14px); color: var(--mai-text); background: var(--mai-bg); border: 1px solid var(--mai-border); border-radius: 8px; padding: 4px 6px; min-height: 34px; max-width: 260px; flex-shrink: 0; cursor: pointer; }
.mai-web select:focus-visible { outline: 3px solid rgba(15,139,125,.35); outline-offset: 1px; }
.mai-google { text-decoration: none; white-space: nowrap; direction: ltr; }
.mai-google .mai-g { color: #4C7DF0; font-weight: 800; }
.mai-search-box.is-independent { border-color: #4C7DF0; }
@media (max-width: 760px) { .mai-web select { max-width: 100%; min-height: 44px; } }

/* إعادة صندوق بنموذج آخر، والتنقّل بين نسخه، وتنبيه ما بُني على إجابات تغيّرت */
.mai-redo, .mai-vers { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--mai-border); background: var(--mai-bg); flex-wrap: wrap; }
.mai-redo[hidden], .mai-vers[hidden] { display: none; }
.mai-redo-btn { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: var(--t-teal, #0F8B7D); color: #fff; font: inherit; font-weight: 700; font-size: var(--mai-ui-sm, 14px); cursor: pointer; padding: 6px 12px; }
.mai-redo-btn:hover { filter: brightness(1.08); }
.mai-redo-cancel { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--mai-border); background: transparent; color: var(--mai-text); cursor: pointer; }
.mai-vers { justify-content: center; font-size: var(--mai-ui-sm, 14px); color: var(--mai-text); }
.mai-vers-label { font-weight: 600; text-align: center; }
.mai-vers-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--mai-border); background: var(--mai-bg); color: var(--mai-text); font-size: 18px; line-height: 1; cursor: pointer; }
.mai-vers-btn:disabled { opacity: .35; cursor: default; }
.mai-vers-btn:not(:disabled):hover { border-color: var(--t-teal, #0F8B7D); color: var(--t-teal, #0F8B7D); }
.mai-stale { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: #FFF4DB; border: 1px solid #F5B83D; color: #6b4a00; font-size: var(--mai-ui-sm, 14px); font-weight: 600; }
@media (max-width: 640px) { .mai-redo-btn { min-height: 44px; } .mai-redo-cancel, .mai-vers-btn { width: 44px; height: 44px; } }

/* الرأي الختامي للمراجِع: لوحة داكنة بلون الإجابة الموحّدة */
.mai-verdict { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: #121A33; color: #fff; line-height: 1.8; font-weight: 500; }
.mai-verdict .mai-verdict-h { display: block; color: #F5B83D; font-weight: 700; margin-bottom: 2px; }
.mai-verdict .mai-verdict-h::before { content: "★ "; }
.mai-verdict strong { color: #fff; }
.mai-web-notes-h { display: block; margin-top: 4px; color: #4C7DF0; }

/* نافذة التأكيد (جديد أثناء التوليد) */
.mai-confirm { position: fixed; inset: 0; z-index: 100000; background: rgba(18,26,51,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mai-confirm-card { background: var(--mai-bg, #fff); color: var(--mai-text, #1f2937); border-radius: 16px; padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.mai-confirm-msg { margin: 0 0 16px; font-size: calc(var(--mai-ui, 16px) + 1px); line-height: 1.7; font-weight: 600; }
.mai-confirm-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.mai-confirm-btns button { flex: 1; min-height: 44px; }

/* تنبيه العائلة الواحدة في صندوق المراجِع */
.mai-family { padding: 7px 12px; background: #FFF4DB; border-bottom: 1px solid #F5B83D; color: #6b4a00; font-size: var(--mai-ui-sm, 14px); font-weight: 600; line-height: 1.6; }
.mai-family[hidden] { display: none; }

/* التكلفة التقديرية بجانب زر الإرسال */
.mai-estimate { font-size: var(--mai-ui-sm, 14px); color: var(--mai-muted, #4b5563); white-space: nowrap; cursor: help; }
.mai-estimate[hidden] { display: none; }
@media (max-width: 640px) { .mai-prompt-bar .mai-estimate { grid-column: 1 / -1; text-align: center; } }

/* علامات الاتفاق داخل الإجابة الموحّدة */
.mai-agree { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; font-size: .78em; font-weight: 700; line-height: 1.6; vertical-align: 2px; white-space: nowrap; cursor: help; border: 1px solid transparent; }
.mai-agree-all { background: #E3F4EF; color: #0B6B60; border-color: #9fd8cc; }
.mai-agree-most { background: #EEF4FB; color: #2F5BB7; border-color: #bcd0f2; }
.mai-agree-few { background: #FFF4DB; color: #8a5a00; border-color: #F5B83D; }
.mai-agree-x { color: #b42318; }
.mai-agree-web { background: #EAF1FE; color: #2F5BB7; border-color: #4C7DF0; }

/* رصيد المختبِر في الشريط العلوي */
.mai-top-credit { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; border: 1px solid #9fd8cc; background: #E3F4EF; color: #0B6B60; font-weight: 700; font-size: 14px; white-space: nowrap; }
.mai-top-credit.is-low { background: #FFF4DB; border-color: #F5B83D; color: #8a5a00; }

/* بطاقة فريق الاختبار في صفحة التعريف */
.mai-join { margin: 28px auto; max-width: 820px; padding: 0 16px; }
.mai-join-card { background: #fff; border: 1px solid #dbe3ef; border-top: 5px solid #0F8B7D; border-radius: 18px; padding: 24px; box-shadow: 0 10px 30px rgba(18,26,51,.06); }
.mai-join-badge { display: inline-block; background: #121A33; color: #F5B83D; font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 999px; }
.mai-join-head h2 { margin: 10px 0 6px; font-size: 24px; color: #121A33; }
.mai-join-head p { margin: 0 0 16px; color: #4b5563; line-height: 1.8; }
.mai-join-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mai-join-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: #121A33; font-size: 15px; }
.mai-join-form input, .mai-join-form textarea { font: inherit; font-weight: 400; padding: 10px 12px; min-height: 44px; border: 1px solid #cfd8e6; border-radius: 10px; background: #f8fafc; }
.mai-join-form input:focus, .mai-join-form textarea:focus { outline: 3px solid rgba(15,139,125,.25); border-color: #0F8B7D; background: #fff; }
.mai-join-wide { grid-column: 1 / -1; }
.mai-join-btn { grid-column: 1 / -1; justify-self: start; min-height: 46px; padding: 0 28px; font: inherit; font-size: 16px; font-weight: 700; color: #fff; background: #0F8B7D; border: 0; border-radius: 12px; cursor: pointer; box-shadow: 0 6px 16px rgba(15,139,125,.25); }
.mai-join-btn:hover { background: #0c766a; }
.mai-join-btn:focus-visible { outline: 3px solid rgba(15,139,125,.35); outline-offset: 2px; }
.mai-join { position: relative; }
.mai-join-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0; }
.mai-join-msg { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-weight: 600; line-height: 1.7; }
.mai-join-msg.is-ok { background: #E3F4EF; color: #0B6B60; border: 1px solid #9fd8cc; }
.mai-join-msg.is-warn { background: #FFF4DB; color: #6b4a00; border: 1px solid #F5B83D; }
@media (max-width: 640px) { .mai-join-form { grid-template-columns: 1fr; } .mai-join-btn { justify-self: stretch; } .mai-join-card { padding: 18px; } }

/* مفتاح علامات النماذج */
.mai-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 10px; font-size: 15px; font-weight: 600; color: #374151; }
.mai-legend span { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: #f3f6fa; border: 1px solid #e2e8f0; line-height: 1.6; }
@media (max-width: 640px) { .mai-legend { font-size: 14px; gap: 6px; } .mai-legend span { padding: 3px 10px; } }

/* ---------- دليل الاستخدام ---------- */
.mai-guide { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; color: #1f2937; font-family: 'Readex Pro', system-ui, sans-serif; line-height: 1.85; }
.mai-g-hero { text-align: center; padding: 28px 8px 8px; }
.mai-g-kicker { display: inline-block; background: #121A33; color: #F5B83D; font-weight: 700; font-size: 13px; padding: 3px 14px; border-radius: 999px; }
.mai-g-hero h1 { margin: 12px 0 8px; font-size: clamp(26px, 5vw, 38px); color: #121A33; line-height: 1.3; }
.mai-g-hero p { margin: 0 auto 16px; max-width: 640px; font-size: 17px; color: #4b5563; }
.mai-g-back, .mai-g-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 24px; border-radius: 12px; background: #0F8B7D; color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 6px 16px rgba(15,139,125,.25); }
.mai-g-back:hover, .mai-g-cta:hover { background: #0c766a; color: #fff; }
.mai-g-video { margin: 24px 0; border-radius: 18px; overflow: hidden; background: #121A33; box-shadow: 0 14px 40px rgba(18,26,51,.18); }
.mai-g-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #121A33; }
.mai-g-toc { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0 8px; }
.mai-g-toc a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 14px; border-radius: 999px; background: #f3f6fa; border: 1px solid #e2e8f0; color: #121A33; text-decoration: none; font-size: 14px; font-weight: 600; }
.mai-g-toc a:hover { border-color: #0F8B7D; color: #0F8B7D; }
.mai-g-sec { margin: 18px 0; padding: 22px 24px; background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; box-shadow: 0 6px 18px rgba(18,26,51,.05); scroll-margin-top: 80px; }
.mai-g-sec h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 21px; color: #121A33; }
.mai-g-ico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: #E3F4EF; font-size: 20px; flex: none; }
.mai-g-steps { margin: 0; padding: 0; list-style: none; counter-reset: g; }
.mai-g-steps li { position: relative; counter-increment: g; padding-inline-start: 44px; margin: 0 0 12px; font-size: 16px; }
.mai-g-steps li::before { content: counter(g); position: absolute; inset-inline-start: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%; background: #121A33; color: #F5B83D; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.mai-g-rows { margin: 0; display: grid; gap: 10px; }
.mai-g-rows > div { display: grid; grid-template-columns: 190px 1fr; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid #edf1f6; }
.mai-g-rows dt { font-weight: 700; color: #121A33; }
.mai-g-rows dd { margin: 0; color: #374151; }
.mai-g-note { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: #EEF4FB; color: #2F5BB7; font-size: 15px; }
.mai-g-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; border-radius: 999px; border: 1px solid #dbe3ef; background: #f3f6fa; font-weight: 700; font-size: 14px; line-height: 1.9; white-space: nowrap; vertical-align: 1px; }
.mai-g-chip.ok { background: #E3F4EF; color: #0B6B60; border-color: #9fd8cc; }
.mai-g-chip.most { background: #EEF4FB; color: #2F5BB7; border-color: #bcd0f2; }
.mai-g-chip.few { background: #FFF4DB; color: #8a5a00; border-color: #F5B83D; }
.mai-g-chip.web { background: #EAF1FE; color: #2F5BB7; border-color: #4C7DF0; }
.mai-g-chip.dark { background: #121A33; color: #F5B83D; border-color: #121A33; }
.mai-g-end { text-align: center; margin-top: 28px; }
.mai-g-end p { color: #4b5563; }
@media (max-width: 640px) {
	.mai-g-sec { padding: 18px 16px; }
	.mai-g-sec h2 { font-size: 19px; }
	.mai-g-rows > div { grid-template-columns: 1fr; gap: 2px; }
	.mai-g-steps li { font-size: 15px; padding-inline-start: 40px; }
	.mai-g-hero p { font-size: 16px; }
}

/* =====================================================================
   معاني الرموز وشريط الأدوات: ثابتان تحت رأس الصفحة عند التمرير
   ===================================================================== */
.mai-stick { position: sticky; top: var(--mai-stick-top, 0px); z-index: 900; background: var(--mai-bg); padding-top: 8px; margin-top: -8px; transition: box-shadow .2s ease; }
.mai.in-shell .mai-stick { background: var(--t-mist, #f4f7fb); }
.mai-stick.is-stuck { box-shadow: 0 12px 14px -14px rgba(18, 26, 51, .45); }
.mai-stick > .mai-toolbar { margin-bottom: 0; }
.mai-stick { padding-bottom: 12px; }
.mai.in-shell .mai-stick > .mai-toolbar:not(.mai-toolbar-bottom) { padding-bottom: 0; }
/* ما يُمرَّر إليه لا يختفي تحت الشريط */
#mai-app { scroll-margin-top: var(--mai-stick-top, 0px); }
#mai-app .mai-box, #mai-app .mai-review-box, #mai-app .mai-prompt, #mai-app .mai-final-box, #mai-app .mai-followup { scroll-margin-top: calc(var(--mai-stick-top, 0px) + var(--mai-stick-h, 0px) + 10px); }
@media (max-width: 760px) {
	/* على الجوال: الشريط مضغوط حتى لا يأخذ مساحة كبيرة من الشاشة */
	.mai-stick { padding-top: 6px; margin-top: -6px; padding-bottom: 8px; }
	.mai-stick .mai-legend { margin-bottom: 6px; gap: 4px; font-size: 12.5px; flex-wrap: nowrap; }
	.mai-stick .mai-legend span { padding: 2px 8px; gap: 4px; }
	.mai-stick .mai-toolbar { gap: 6px 14px; }
	.mai-stick .mai-tool { min-height: 38px; padding: 4px 12px; }
}

/* رأس الصفحة على الجوال: كل الأزرار تتسع في سطر واحد (السجل، جديد، الرصيد، الدليل، اللغة) */
@media (max-width: 480px) {
	.mai-top:has(#mai-hist-open) .mai-top-name { display: none; }
	.mai-top-in { gap: 6px; padding: 6px 10px; }
	.mai-top-actions { gap: 6px; }
	.mai-top-btn { padding: 6px 8px; }
	/* زر اللغة الأخرى فقط، فيعمل مفتاحاً للتبديل */
	.mai-top-langs .mai-lang.is-on { display: none; }
	.mai-top-langs .mai-lang { min-width: 44px; min-height: 42px; }
	.mai-top-credit > span[aria-hidden] { display: none; }
	.mai-top-credit { padding-inline: 10px; }
	.mai-top-actions > .mai-top-btn:not(.mai-top-cta) { width: 44px; padding: 0; overflow: hidden; }
	.mai-top-actions > .mai-top-cta { width: auto; padding: 6px 12px; white-space: nowrap; }
}
@media (max-width: 380px) {
	.mai-top-brand img { height: 26px; }
	.mai-top-in, .mai-top-actions { gap: 4px; }
	.mai-top-in { padding: 6px 8px; }
	.mai-top-credit { padding-inline: 8px; font-size: 13px; }
}
@media (max-width: 340px) {
	.mai-top-actions > .mai-top-btn:not(.mai-top-cta), .mai-top-langs .mai-lang { width: 40px; min-width: 40px; min-height: 40px; }
}

/* =====================================================================
   ملاحظات المختبِرين: 👍 / 👎 / أبلغ عن مشكلة تحت كل إجابة
   ===================================================================== */
.mai-fb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 14px; border-top: 1px dashed var(--mai-border, #dde3ec); }
.mai-fb[hidden] { display: none; }
.mai-fb.is-err [data-fb="up"], .mai-fb.is-err [data-fb="down"] { display: none; }
.mai-fb-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.mai-fb-btn { min-height: 36px; min-width: 40px; padding: 4px 10px; border: 1px solid var(--mai-border, #dde3ec); border-radius: 999px; background: #fff; color: #4a5468; font: inherit; font-size: 14px; line-height: 1; cursor: pointer; transition: background .15s, border-color .15s; }
.mai-fb-btn:hover { border-color: #b7c2d3; background: #f6f8fb; }
.mai-fb-btn[data-fb="up"].is-on { background: #E3F4EF; border-color: #0F8B7D; }
.mai-fb-btn[data-fb="down"].is-on { background: #FDECEA; border-color: #E8735A; }
.mai-fb-rep { font-size: 13px; }
.mai-fb-ok { font-size: 13px; color: #0B6B60; font-weight: 600; }
.mai-fb-ok.is-err { color: #b32d2e; }
.mai-fb-note { flex: 1 1 100%; display: flex; gap: 8px; align-items: flex-end; }
.mai-fb-note[hidden] { display: none; }
.mai-fb-note textarea { flex: 1; min-height: 44px; resize: vertical; padding: 8px 10px; border: 1px solid var(--mai-border, #dde3ec); border-radius: 10px; font: inherit; font-size: 15px; }
.mai-fb-note .mai-btn { flex: none; width: auto; padding: 8px 16px; min-height: 44px; margin: 0; }
.mai-fb-rep.is-open { border-color: #F5B83D; background: #FFF4DB; }
.mai-final-box > .mai-fb { border-top-color: #cfe6df; }

/* «أي إجابة كانت الأفضل؟» */
.mai-vote { margin: 14px 0; padding: 14px 16px; border: 1px solid #cfe6df; border-radius: 14px; background: #F2FAF7; }
.mai-vote[hidden] { display: none; }
.mai-vote-q { margin-bottom: 10px; line-height: 1.5; }
.mai-vote-q b { font-size: 16px; color: #121A33; }
.mai-vote-q span { color: #5b6475; font-size: 14px; margin-inline-start: 6px; }
.mai-vote-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.mai-vote-opt { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; padding: 6px 14px; border: 1px solid #b9dcd2; border-radius: 12px; background: #fff; color: #121A33; font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.mai-vote-opt b { font-size: 14px; font-weight: 700; }
.mai-vote-opt small { font-size: 12px; color: #5b6475; direction: ltr; }
.mai-vote-opt:hover { border-color: #0F8B7D; }
.mai-vote-opt.is-on { background: #0F8B7D; border-color: #0F8B7D; color: #fff; }
.mai-vote-opt.is-on small { color: #dff3ee; }
.mai-vote-ok { margin-top: 8px; font-size: 14px; font-weight: 600; color: #0B6B60; }
.mai-vote-ok.is-err { color: #b32d2e; }
@media (max-width: 760px) {
	.mai-vote { order: 0; }
	.mai-vote-opt { flex: 1 1 calc(50% - 8px); }
	.mai-fb { padding: 8px 10px; }
	.mai-fb-btn { min-height: 40px; }
}

/* أزرار Excel: لا تظهر إلا حين يوجد جدول */
.mai .mai-tool[hidden], .mai .mai-copy[hidden] { display: none !important; }
/* رأس الصندوق: إن ضاق المكان نزلت الأزرار إلى سطر ثانٍ بدل أن تضيّق قائمة النموذج */
@media (min-width: 761px) {
	.mai-box-head { flex-wrap: wrap; row-gap: 6px; }
	.mai-box-head .mai-model { flex: 1 1 190px; }
}

/* =====================================================================
   صفحة «النماذج والأدوات» (?models=1)
   ===================================================================== */
.mai-legend .mai-legend-more { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; border: 1px dashed #0F8B7D; color: #0B6B60; font-weight: 600; text-decoration: none; background: #fff; }
.mai-legend .mai-legend-more:hover { background: #E3F4EF; }
.mai-mp-guide { display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px; margin-inline-start: 8px; border-radius: 12px; border: 1px solid #cfe6df; background: #fff; color: #0B6B60; font-weight: 700; text-decoration: none; }
.mai-mp-guide:hover { background: #E3F4EF; color: #0B6B60; }
.mai-mp-count { display: inline-block; margin-inline-start: 6px; padding: 1px 10px; border-radius: 999px; background: #E3F4EF; color: #0B6B60; font-size: 14px; font-weight: 700; }
.mai-mp-lead { color: #4b5563; margin: 0 0 14px; line-height: 1.8; }
.mai-mp-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mai-mp-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.mai-mp-table th { text-align: start; font-size: 13px; color: #5b6475; font-weight: 600; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.mai-mp-table td { padding: 10px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.mai-mp-table tbody tr:hover { background: #f8fafc; }
.mai-mp-yes { color: #0F8B7D; font-weight: 800; font-size: 17px; }
.mai-mp-no { color: #9aa3b2; }
.mai-mp-tag { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; background: #e8f1fd; color: #1d4f91; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mai-mp-tag.mai-mp-warn { background: #FDECEA; color: #a3362a; }
.mai-mp-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mai-mp-tool { padding: 14px 16px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fbfcfe; }
.mai-mp-tool h3 { margin: 0 0 6px; font-size: 16px; color: #121A33; display: flex; gap: 8px; align-items: center; }
.mai-mp-tool p { margin: 0; color: #4b5563; line-height: 1.75; font-size: 14.5px; }
.mai-mp-tool .mai-mp-uses { margin-top: 8px; font-size: 13px; color: #0B6B60; }
/* على الجوال: كل نموذج بطاقة، وكل خاصية سطر بعنوانها */
@media (max-width: 640px) {
	.mai-mp-table thead { display: none; }
	.mai-mp-wrap { overflow: visible; }
	.mai-mp-table, .mai-mp-table tbody, .mai-mp-table tr, .mai-mp-table td { display: block; width: 100%; box-sizing: border-box; }
	.mai-mp-table td > * { text-align: end; }
	.mai-mp-table tr { margin: 0 0 10px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
	.mai-mp-table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; }
	.mai-mp-table td::before { content: attr(data-l); color: #5b6475; font-size: 13px; font-weight: 600; flex: none; }
	.mai-mp-table td:first-child { display: block; padding-bottom: 8px; border-bottom: 1px solid #eef2f7; margin-bottom: 4px; font-size: 16px; }
	.mai-mp-table td:first-child::before { content: none; }
	.mai-mp-guide { margin: 10px 0 0; }
}
@media (max-width: 760px) {
	.mai-stick .mai-legend .mai-legend-more { padding: 2px 8px; }
}

/* =====================================================================
   تبويبات صفحات المعلومات (الدليل، والنماذج والأدوات، …)
   ===================================================================== */
.mai-tabs { display: flex; justify-content: center; gap: 6px; margin: 14px auto 0; padding: 5px; width: fit-content; max-width: 100%; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 4px 14px rgba(18,26,51,.06); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mai-tabs::-webkit-scrollbar { display: none; }
.mai-tab { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 42px; padding: 0 16px; border-radius: 12px; color: #374151; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.mai-tab:hover { background: #f3f6fa; color: #121A33; }
.mai-tab.is-on { background: #0F8B7D; color: #fff; box-shadow: 0 4px 12px rgba(15,139,125,.25); }
.mai-tab.is-on:hover { background: #0c766a; color: #fff; }
.mai-tab-home { color: #5b6475; }
.mai-tabs + .mai-g-hero { padding-top: 18px; }
@media (max-width: 480px) {
	.mai-tabs { width: 100%; justify-content: flex-start; }
	.mai-tab { padding: 0 12px; font-size: 14px; }
}
.mai-tabs ~ .mai-g-hero .mai-g-kicker { display: none; }
@media (max-width: 480px) {
	.mai-tab-home .mai-tab-t { display: none; }
	.mai-tab { padding: 0 11px; }
}
/* الزوار على الجوال: زر «تسجيل الدخول» يأخذ مكان اسم Tetrova بجانب الشعار (الاسم ظاهر في صفحة التعريف) */
@media (max-width: 420px) {
	.mai-top:has(.mai-top-cta) .mai-top-name { display: none; }
}
/* على الجوال: معاني الرموز في سطر واحد يُسحب أفقياً، فيبقى الشريط الثابت قصيراً */
@media (max-width: 760px) {
	.mai-stick .mai-legend { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; font-size: 12px; padding-inline: 2px; -webkit-mask-image: linear-gradient(to left, #000 88%, transparent); mask-image: linear-gradient(to left, #000 88%, transparent); }
	.mai-stick .mai-legend::-webkit-scrollbar { display: none; }
	.mai-stick .mai-legend span, .mai-stick .mai-legend a { flex: none; padding: 2px 7px; }
}
[dir="ltr"] .mai-stick .mai-legend, .mai[dir="ltr"] .mai-stick .mai-legend { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
@media (min-width: 761px) { .mai-stick .mai-legend { -webkit-mask-image: none !important; mask-image: none !important; } }

/* =====================================================================
   وضع «فيديو»
   ===================================================================== */
.mai.is-vidmode .mai-depth-row { display: none; }
.mai-vid-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0 4px; padding: 10px 12px; border: 1px dashed #cfe6df; border-radius: 12px; background: #F2FAF7; }
.mai-vid-opts[hidden] { display: none; }
.mai-vid-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #374151; }
.mai-vid-opt b { font-weight: 600; color: #121A33; }
.mai-vid-opt select { min-height: 38px; padding: 4px 8px; border: 1px solid var(--mai-border, #dde3ec); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; }
.mai-vid-n { display: inline-flex; gap: 4px; }
.mai-vid-nb { min-width: 38px; min-height: 38px; border: 1px solid #b9dcd2; border-radius: 10px; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.mai-vid-nb.is-on { background: #0F8B7D; border-color: #0F8B7D; color: #fff; }
.mai-vid-nb[hidden] { display: none; }
.mai-vid-audio input { width: 18px; height: 18px; }
.mai-vid-note { font-size: 13px; color: #5b6475; }
.mai-check.mai-vidmode[hidden] { display: none; }
/* عدد الصناديق في وضع الفيديو */
.mai.is-vidmode[data-vidn="1"] [data-role="gen"]:not([data-index="0"]),
.mai.is-vidmode[data-vidn="2"] [data-role="gen"][data-index="2"],
.mai.is-vidmode[data-vidn="2"] [data-role="gen"][data-index="3"],
.mai.is-vidmode[data-vidn="3"] [data-role="gen"][data-index="3"] { display: none; }
.mai.is-vidmode[data-vidn="1"] .mai-generators { grid-template-columns: minmax(0, 1fr); max-width: 900px; margin-inline: auto; }
.mai-gen-video { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.mai-gen-vidfig { margin: 0; }
@media (max-width: 760px) {
	.mai-vid-opts { gap: 8px 12px; }
	.mai-vid-note { flex-basis: 100%; }
}
.mai.is-vidmode [data-role="gen"] .mai-box-tools { display: none !important; }


/* بطاقة «مهام الاختبار» */
.mai-tasks { margin: 0 0 12px; border: 1px solid #cfe6df; border-radius: 14px; background: #F2FAF7; transition: box-shadow .3s ease; }
.mai-tasks > summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; min-height: 44px; box-sizing: border-box; }
.mai-tasks > summary::-webkit-details-marker { display: none; }
.mai-tasks > summary::after { content: '▾'; color: #0B6B60; font-size: 14px; transition: transform .2s ease; }
.mai-tasks[open] > summary::after { transform: rotate(180deg); }
.mai-tasks-t { font-weight: 700; color: #121A33; white-space: nowrap; }
.mai-tasks-bar { flex: 1; min-width: 40px; height: 8px; border-radius: 99px; background: #d9ece6; overflow: hidden; }
.mai-tasks-bar i { display: block; height: 100%; background: #0F8B7D; border-radius: inherit; transition: width .5s ease; }
.mai-tasks-n { font-size: 14px; color: #3d4757; white-space: nowrap; }
.mai-tasks-n b { color: #0B6B60; font-size: 15px; }
.mai-tasks-lead { margin: 0 14px 8px; font-size: 14px; color: #4b5563; line-height: 1.6; }
.mai-tasks-list { list-style: none; margin: 0; padding: 0 10px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.mai-tasks-list li { display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid #e2efeb; line-height: 1.45; transition: background .3s ease, border-color .3s ease; }
.mai-tasks-list li b { display: block; font-size: 14.5px; font-weight: 600; color: #121A33; }
.mai-tasks-list li small { display: block; font-size: 12.5px; color: #5b6475; margin-top: 1px; }
.mai-task-ck { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 2px solid #9fc9c0; background: #fff; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; transition: background .3s ease, border-color .3s ease; }
.mai-tasks-list li.is-done { background: #e6f5f1; border-color: #b9dcd2; }
.mai-tasks-list li.is-done b { color: #0B6B60; }
.mai-tasks-list li.is-done .mai-task-ck { background: #0F8B7D; border-color: #0F8B7D; }
.mai-tasks-list li.is-done .mai-task-ck::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.mai-tasks-list li.is-new { animation: mai-task-pop 1.2s ease; }
@keyframes mai-task-pop { 0% { transform: scale(1); } 30% { transform: scale(1.03); box-shadow: 0 0 0 4px rgba(15, 139, 125, .18); } 100% { transform: scale(1); } }
.mai-tasks.is-ping { box-shadow: 0 0 0 4px rgba(15, 139, 125, .22); }
.mai-tasks-thanks { display: none; margin: 0 14px 12px; padding: 10px 12px; border-radius: 10px; background: #0F8B7D; color: #fff; font-weight: 600; font-size: 14.5px; line-height: 1.6; }
.mai-tasks.is-all .mai-tasks-thanks { display: block; }
.mai-tasks.is-all .mai-tasks-lead { display: none; }
@media (prefers-reduced-motion: reduce) { .mai-tasks-list li.is-new { animation: none; } }
@media (max-width: 760px) {
	.mai-tasks { order: -3; margin: 0; }
	.mai-tasks > summary { padding: 8px 12px; gap: 8px; }
	.mai-tasks-t { font-size: 14.5px; }
	.mai-tasks-list { grid-template-columns: 1fr; padding: 0 8px 10px; gap: 5px; }
	.mai-tasks-list li { padding: 7px 10px; }
}

/* =====================================================================
   صفحات المعلومات: لماذا Tetrova، والدليل الكامل، والأسئلة الشائعة، ومكتبة المطالبات (0.30.0)
   ===================================================================== */
.mai-why, .mai-faq, .mai-pl { max-width: 1040px; }
.mai-gx { max-width: 1200px; }
.mai-i-search { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 18px auto 6px; padding: 0 14px; min-height: 50px; background: #fff; border: 1px solid #dbe3ef; border-radius: 14px; box-shadow: 0 4px 14px rgba(18,26,51,.05); }
.mai-i-search:focus-within { border-color: #0F8B7D; box-shadow: 0 0 0 3px rgba(15,139,125,.15); }
.mai-i-q { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: #121A33; padding: 10px 0; }
.mai-i-count { font-size: 13px; color: #5b6475; white-space: nowrap; }
.mai-i-none { text-align: center; color: #5b6475; margin: 18px 0; }
.mai-i-list { margin: 0; padding-inline-start: 20px; }
.mai-i-list li { margin: 0 0 8px; }
.mai-g-sec p { margin: 0 0 10px; }
.mai-g-sec p:last-child { margin-bottom: 0; }
.mai-guide kbd { display: inline-block; min-width: 22px; padding: 0 6px; border: 1px solid #cfd6e1; border-bottom-width: 2px; border-radius: 6px; background: #f8fafc; font: 600 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #121A33; text-align: center; direction: ltr; unicode-bidi: isolate; }
.mai-guide a:not([class]) { color: #0B6B60; font-weight: 600; }

/* الدليل الكامل: فهرس ثابت بجانب المحتوى على الحاسوب، وقابل للطي على الجوال */
.mai-gx-wrap { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 14px; }
.mai-gx-side { min-width: 0; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; scrollbar-width: thin; }
body.admin-bar .mai-gx-side { top: 116px; max-height: calc(100vh - 132px); }
.mai-gx-index { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 6px 8px 10px; box-shadow: 0 6px 18px rgba(18,26,51,.05); }
.mai-gx-index > summary { cursor: pointer; list-style: none; font-weight: 700; color: #121A33; padding: 8px 10px; border-radius: 10px; }
.mai-gx-index > summary::-webkit-details-marker { display: none; }
.mai-gx-index > summary::after { content: '▾'; float: inline-end; color: #5b6475; transition: transform .15s; }
.mai-gx-index:not([open]) > summary::after { transform: rotate(-90deg); }
[dir="rtl"] .mai-gx-index:not([open]) > summary::after { transform: rotate(90deg); }
.mai-gx-toc, .mai-gx-toc ol { list-style: none; margin: 0; padding: 0; }
.mai-gx-toc > li { margin: 2px 0; }
.mai-gx-toc a { display: block; padding: 5px 10px; border-radius: 9px; color: #374151; text-decoration: none; font-size: 14.5px; line-height: 1.5; }
.mai-gx-toc > li > a { font-weight: 700; color: #121A33; }
.mai-gx-toc ol a { font-size: 13.5px; padding-inline-start: 34px; color: #4b5563; }
.mai-gx-toc a:hover { background: #f3f6fa; color: #0B6B60; }
.mai-gx-toc a.is-on { background: #E3F4EF; color: #0B6B60; }
.mai-gx-n { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; background: #121A33; color: #F5B83D; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.mai-gx-sec h2 .mai-gx-n { min-width: 28px; height: 28px; font-size: 14px; }
.mai-gx-sec { margin-top: 0; }
.mai-gx-sub { padding: 14px 0 4px; border-top: 1px solid #eef2f7; scroll-margin-top: 90px; }
.mai-gx-sec h2 + .mai-gx-sub { border-top: 0; padding-top: 2px; }
.mai-gx-sub h3 { margin: 0 0 8px; font-size: 17px; color: #0B6B60; }
.mai-gx-body { font-size: 16px; color: #1f2937; }
.mai-gx-body ul, .mai-gx-body ol { margin: 0 0 8px; padding-inline-start: 22px; }
.mai-gx-body li { margin: 0 0 7px; }
.mai-gx-main > .mai-g-end { margin-top: 10px; }
@media (max-width: 999px) {
	.mai-gx-wrap { grid-template-columns: minmax(0, 1fr); gap: 10px; }
	.mai-gx-side { position: static; max-height: none; overflow: visible; }
}

/* لماذا Tetrova؟ */
.mai-why-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mai-why-two .mai-g-sec { margin: 0; }
.mai-why-two + .mai-g-sec { margin-top: 18px; }
.mai-why .mai-g-sec p, .mai-why .mai-i-list { font-size: 16px; }
.mai-why-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mai-why-card { padding: 16px 18px; border: 1px solid #e2e8f0; border-radius: 16px; background: linear-gradient(180deg, #fbfdfd, #fff); }
.mai-why-ic { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; background: #121A33; color: #F5B83D; font-size: 20px; margin-bottom: 8px; }
.mai-why-card h3 { margin: 0 0 6px; font-size: 17px; color: #121A33; }
.mai-why-card p { margin: 0; font-size: 15px; color: #4b5563; line-height: 1.8; }
.mai-why-cmp { display: grid; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.mai-why-row { display: grid; grid-template-columns: 1fr 1.2fr 1.4fr; }
.mai-why-row > span { padding: 11px 14px; border-top: 1px solid #eef2f7; font-size: 15px; color: #374151; }
.mai-why-row > span:first-child { font-weight: 700; color: #121A33; }
.mai-why-row > .is-us { background: #E3F4EF; color: #0B6B60; font-weight: 600; }
.mai-why-hd > span { border-top: 0; background: #f8fafc; font-size: 13px; font-weight: 700; color: #5b6475; }
.mai-why-hd > span:last-child { background: #121A33; color: #F5B83D; }
.mai-why-who { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.mai-why-who > div { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; padding: 12px 14px; border-radius: 14px; background: #f8fafc; border: 1px solid #edf1f6; }
.mai-why-who > div > span { grid-row: span 2; font-size: 24px; line-height: 1.2; }
.mai-why-who strong { color: #121A33; }
.mai-why-who p { margin: 0; color: #4b5563; font-size: 14.5px; line-height: 1.7; }
.mai-why-honest { margin: 18px 0 0; background: #FFF4DB; color: #6b4a00; }
@media (max-width: 760px) {
	.mai-why-two { grid-template-columns: 1fr; }
	.mai-why-hd { display: none; }
	.mai-why-row { grid-template-columns: 1fr; padding: 10px 12px; border-top: 1px solid #eef2f7; }
	.mai-why-row:first-of-type { border-top: 0; }
	.mai-why-row > span { border-top: 0; padding: 3px 0; }
	.mai-why-row > span[data-l]::before { content: attr(data-l) ': '; font-weight: 700; color: #5b6475; font-size: 13px; }
	.mai-why-row > .is-us { background: none; }
}

/* الأسئلة الشائعة */
.mai-faq-q { border: 1px solid #e2e8f0; border-radius: 12px; margin: 0 0 8px; background: #fff; }
.mai-faq-q > summary { cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 700; color: #121A33; display: flex; gap: 10px; align-items: flex-start; }
.mai-faq-q > summary::-webkit-details-marker { display: none; }
.mai-faq-q > summary::before { content: '+'; flex: none; width: 22px; height: 22px; border-radius: 50%; background: #E3F4EF; color: #0B6B60; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-top: 3px; }
.mai-faq-q[open] > summary::before { content: '−'; background: #0F8B7D; color: #fff; }
.mai-faq-q[open] { border-color: #9fd8cc; box-shadow: 0 4px 14px rgba(15,139,125,.08); }
.mai-faq-a { padding: 0 16px 12px 16px; padding-inline-start: 48px; color: #374151; font-size: 15.5px; }
.mai-faq-g h2 { margin-bottom: 14px; }

/* مكتبة المطالبات */
.mai-pl-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 6px; }
.mai-pl-cat { display: inline-flex; gap: 6px; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #e2e8f0; background: #f3f6fa; color: #121A33; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.mai-pl-cat:hover { border-color: #0F8B7D; color: #0B6B60; }
.mai-pl-cat.is-on { background: #0F8B7D; border-color: #0F8B7D; color: #fff; }
.mai-pl-group { margin: 20px 0 8px; scroll-margin-top: 90px; }
.mai-pl-group > h2 { display: flex; gap: 8px; align-items: center; margin: 0 0 4px; font-size: 20px; color: #121A33; }
.mai-pl-note { margin: 0 0 10px; color: #5b6475; font-size: 14.5px; }
.mai-pl-grid, .mai-pl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mai-pl-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 4px 12px rgba(18,26,51,.04); scroll-margin-top: 90px; }
.mai-pl-card:hover { border-color: #9fd8cc; }
.mai-pl-card h3 { margin: 0; font-size: 16.5px; color: #121A33; }
.mai-pl-text { margin: 0; white-space: pre-line; font-size: 14.5px; line-height: 1.8; color: #374151; background: #f8fafc; border: 1px solid #edf1f6; border-radius: 10px; padding: 8px 10px; flex: 1; }
.mai-pl-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.mai-pl-flags .mai-mp-tag { margin: 0; }
.mai-pl-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mai-pl-use { display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border-radius: 10px; border: 0; background: #0F8B7D; color: #fff; font: inherit; font-weight: 700; font-size: 14.5px; text-decoration: none; cursor: pointer; }
.mai-pl-use:hover { background: #0c766a; color: #fff; }
.mai-pl-btn, .mai-pl-cancel { display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid #dbe3ef; background: #fff; color: #121A33; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.mai-pl-btn:hover, .mai-pl-cancel:hover { border-color: #0F8B7D; color: #0B6B60; }
.mai-pl-del.is-sure { background: #FDECEA; border-color: #f0b4ac; color: #a3362a; }
.mai-pl-btn:disabled, .mai-pl-use:disabled { opacity: .6; cursor: default; }
.mai-pl-mine { border-color: #F5B83D; background: linear-gradient(180deg, #FFFBF1, #fff 120px); }
.mai-pl-form { display: grid; gap: 8px; margin: 0 0 14px; }
.mai-pl-form input[type="text"], .mai-pl-form textarea { width: 100%; box-sizing: border-box; border: 1px solid #dbe3ef; border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 15.5px; color: #121A33; background: #fff; }
.mai-pl-form textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.mai-pl-form input:focus, .mai-pl-form textarea:focus { outline: 0; border-color: #0F8B7D; box-shadow: 0 0 0 3px rgba(15,139,125,.15); }
.mai-pl-form-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mai-pl-form .mai-g-cta { min-height: 42px; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.mai-pl-msg { color: #0B6B60; font-weight: 600; font-size: 14px; }
.mai-pl-empty { margin: 0; color: #5b6475; grid-column: 1 / -1; }
.mai-pl-own .mai-pl-text { max-height: 9.2em; overflow: auto; }
@media (max-width: 760px) {
	.mai-pl-grid, .mai-pl-list { grid-template-columns: 1fr; }
	.mai-pl-cats { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
	.mai-pl-cats::-webkit-scrollbar { display: none; }
	.mai-pl-cat { flex: none; }
	.mai-faq-a { padding-inline-start: 16px; }
}

/* داخل المنصة: رابط المكتبة وحفظ السؤال، وتلميح المطالبة */
.mai-prompt-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; margin: 2px 2px 6px; }
.mai-ptool { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 4px; border: 0; background: none; color: #0B6B60; font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer; border-radius: 8px; }
.mai-ptool:hover { background: #f0fbf9; color: #0B6B60; }
.mai-ptool:disabled { opacity: .6; cursor: default; }
.mai-prompt-hint { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 4px; padding: 8px 12px; border-radius: 10px; background: #EEF4FB; color: #2F5BB7; font-size: 14px; line-height: 1.7; }
.mai-prompt-hint span { flex: 1; }
.mai-prompt-hint button { flex: none; border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; padding: 2px 4px; }
@media (max-width: 760px) {
	.mai-prompt-tools { justify-content: space-between; }
	.mai-ptool { min-height: 36px; }
}
.mai-gx-body .mai-g-chip, .mai-faq-a .mai-g-chip { white-space: normal; max-width: 100%; }
.mai-guide [hidden] { display: none !important; }
.mai-pl-mine .mai-mp-lead, .mai-pl-empty { font-size: 15px; }
.mai-pl-mine h2 { flex-wrap: wrap; }
