/*
 * ثيم اكسجينا (OO2) للويب (قرار المستخدم في 28 نوفمبر 2026): مسطح ثنائي الأبعاد، مستنبط من الشعار، وفيه حركة خفيفة.
 * يحمل بعد app.css فيعلو عليه: الألوان في متغيرات app.css، وهنا الأشكال والحركة.
 * القواعد: لا ظلال ولا تدرجات (التدرج في الشعار وحده)، زوايا مستديرة، خط الشعار المستدير.
 * اللوحة للعمل، فالحركة فيها أقل من التطبيق: لحظة واحدة عند فتح الصفحة، واستجابة عند اللمس.
 */

:root {
    --lime: #84c003;
    --leaf-mid: #3eb763;
    --teal: #00bfb5;
    --lime-tint: #e4f4d4;
    --on-lime-tint: #2f6b12;
    --teal-tint: #d6f5f2;
    --on-teal-tint: #00655f;
    --amber-tint: #fdebd3;
    --on-amber-tint: #8a4b00;
    --danger-tint: #fce4e1;
    --round: 16px;
    --round-control: 12px;
}

::selection { background: var(--lime-tint); color: var(--ink); }
a { text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--leaf-mid); outline-offset: 2px; border-radius: 6px; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 1.1rem; font-weight: 700; }

/* الرأس: أبيض مسطح، وفيه الشعار واسمه، والتنقل حبات مستديرة. */
.topbar { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); padding: 10px 20px; gap: 8px 16px; }
.topbar a, .topbar .link { color: var(--ink); }
.topbar a:hover, .topbar .link:hover { text-decoration: none; color: var(--green); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; }
.brand .oo2-mark { width: 62px; height: auto; flex: none; }
.nav { gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 999px; font-weight: 500; transition: background-color 0.16s ease, color 0.16s ease; }
.nav a:hover { background: var(--bg); }
.nav a.current { background: var(--lime-tint); color: var(--on-lime-tint); text-decoration: none; font-weight: 700; }
.tools { gap: 4px 14px; font-size: 0.92rem; }
.who { opacity: 1; color: var(--muted); }

.oo2-mark { display: block; }

/* البطاقات والجداول: مساحات بيضاء على أرضية تميل إلى الأخضر، بلا حدود ولا ظلال. */
.card, .stat, .tile, .table-wrap { border-color: transparent; border-radius: var(--round); }
.card { padding: 22px; }
.empty { border-radius: var(--round); }
th { background: #eef4eb; color: var(--ink); font-weight: 600; }
tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover { background: #f8fbf6; }
tr:has(td.pick input:checked), tr:has(td.pick input:checked):hover { background: var(--lime-tint); }

/* الأزرار: الرئيسي بالحبر، والثانوي أبيض بإطار. تستجيب عند اللمس. */
.button { padding: 11px 20px; border-radius: var(--round-control); background: var(--ink); transition: background-color 0.16s ease, transform 0.1s ease; }
.button:hover { background: #1d4a3d; }
.button:active { transform: scale(0.98); }
.button.secondary { color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); padding: 9.5px 18.5px; }
.button.secondary:hover { background: var(--lime-tint); border-color: var(--lime-tint); }
.button.danger { background: var(--danger); }
.button:disabled { background: #c3cfc7; transform: none; }
.link { color: var(--green); font-weight: 500; }

/* الحقول. */
.form input[type="text"], .form input[type="email"], .form input[type="tel"], .form input[type="password"], .form select, .form textarea, .form input[type="file"],
.form input[type="date"], .form input[type="number"], .form input[type="url"],
.impact-form input[type="number"], .impact-form input[type="url"], .impact-form input[type="date"], .impact-grid input, .impact-grid select, [data-tree-planting] input,
.link-shown, .share-message textarea, #site-boundary textarea { border-radius: var(--round-control); border-color: var(--line); }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--leaf-mid); outline-offset: 1px; }
.form.settings fieldset, .channels, .impact-source, .preset-list, .purge-list { border-radius: var(--round); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--green); }

/* حقول التاريخ والرقم في نماذج التصفية تأخذ شكل بقية الحقول. */
.form input[type="date"], .form input[type="number"], .form input[type="url"] { width: 100%; padding: 9px 10px; font: inherit; border: 1px solid var(--line); background: #fff; }

/* الشارات والتنبيهات: ألوان الشعار الفاتحة، والبرتقالي للتنبيه. */
.badge { padding: 3px 12px; font-weight: 600; background: var(--lime-tint); color: var(--on-lime-tint); }
.badge.off { background: #e8efe6; color: var(--muted); }
.badge.warn { background: var(--amber-tint); color: var(--on-amber-tint); }
.notice { border: 0; border-radius: 14px; }
.notice.success { background: var(--lime-tint); color: var(--on-lime-tint); }
.notice.warning { background: var(--amber-tint); color: #5c3200; }
.notice.error { background: var(--danger-tint); }
.card.incomplete, fieldset.incomplete { border: 2px solid #e0a800; }

/* الأرقام واللوحة الرئيسية. */
.stat { padding: 18px; }
.stat .number { color: var(--ink); font-variant-numeric: tabular-nums; }
.code { color: var(--ink); }
.tree-page h1 { color: var(--ink); }

/* المبوبات. */
.tabs a { border-color: var(--line); color: var(--ink); transition: background-color 0.16s ease; }
.tabs a:hover { background: var(--lime-tint); }
.tabs a.current { background: var(--ink); border-color: var(--ink); color: #fff; }

/* الصور والخريطة. */
.review-photo img, .photo-pair img, .tree-photo, .lightbox { border-radius: var(--round); background: var(--ink); }
.thumb, .map, #boundary-map, .map-card img { border-radius: var(--round-control); }
.map, #boundary-map { border-color: var(--line); }

/* «تم الحفظ» وشريط أسفل الصفحة: بلا ظلال. */
.toast { background: var(--ink); color: #fff; box-shadow: none; }
.saved-mark { color: var(--green); }
.review-bar { box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: var(--round) var(--round) 0 0; }

/* صفحة الدخول: الشعار يرسم نفسه فوق البطاقة. */
.auth-mark { display: grid; justify-items: center; gap: 4px; margin: 8px 0 20px; }
.auth-mark .oo2-mark { width: 168px; height: auto; }
.auth-mark p { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--ink); }

/* صفحات الحساب (الدخول، اختيار كلمة المرور): زر بعرض البطاقة، وعين الإظهار داخل الحقل لا بجانبه. */
.auth-card h1 { margin-bottom: 4px; }
.auth-lead { margin: 0 0 18px; color: var(--muted); }
.card.narrow .form > .button { width: 100%; margin-top: 8px; }
.password-field { position: relative; display: block; }
/* الحقل يكتب من اليسار دائما، والعين عند نهاية سطر الصفحة: فالفراغ لها يمين الحقل في الإنجليزية ويساره في العربية. */
.form .password-field input { width: 100%; }
[dir="ltr"] .form .password-field input { padding-right: 52px; }
[dir="rtl"] .form .password-field input { padding-left: 52px; }
.password-field .password-toggle { position: absolute; inset-block: 0; inset-inline-end: 4px; margin-block: auto; height: 44px; }
/* بريد الحساب معروض لا يكتب: يظهر كبطاقة صغيرة لا كحقل. */
input.account-email { background: var(--lime-tint); color: var(--on-lime-tint); border-color: transparent; font-weight: 500; cursor: default; }
input.account-email:focus { outline: none; box-shadow: none; }
/* الشروط قبل استيفائها بيان هادئ لا أخطاء: تخضر واحدا واحدا مع الكتابة. والخادم يرفض ما لم يستوف. */
.password-rules { margin: 10px 0 14px; padding: 12px 14px; border-radius: var(--round-control); background: var(--bg); }
.password-rules li { color: var(--muted); }
.password-rules li::before { content: "\25CB"; font-weight: 400; }
.password-rules li.met { color: var(--green); }
.auth-steps { margin: 0 0 14px; padding-inline-start: 22px; display: grid; gap: 6px; font-weight: 500; }

.footer a:hover { color: var(--green); }

/* الحركة: لمن لم يوقفها في جهازه فقط. */
@media (prefers-reduced-motion: no-preference) {
    /* الحركة الافتتاحية (قرار 30 نوفمبر 2026): js/oo2.js يرتب أقسام الصفحة خطوات، وكل قسم يصعد قليلا ويتضح
       في 0.9 ثانية بعد الذي قبله بـ0.2 ثانية. والصفحة مخفية لحظة حتى يكتمل الخط، فلا يتبدل في منتصف الحركة. */
    .oo2-wait main.page { opacity: 0; }
    .oo2-play .oo2-enter { animation: oo2-page-in 0.9s cubic-bezier(0.33, 1, 0.68, 1) both; animation-delay: calc(var(--i, 0) * 0.2s); }

    /* الشعار يرسم نفسه في ثانية: الخط، ثم تنبت الشجرة، ثم الرقم. */
    .oo2-mark.draw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: oo2-draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) forwards; }
    .oo2-mark.draw .oo2-tree { animation-duration: 0.3s; animation-delay: 0.5s; animation-timing-function: ease-out; }
    .oo2-mark.draw .oo2-two { animation-duration: 0.2s; animation-delay: 0.8s; }
}

@keyframes oo2-page-in {
    from { opacity: 0; transform: translate3d(0, 16px, 0); }
    to { opacity: 1; transform: none; }
}

@keyframes oo2-draw {
    to { stroke-dashoffset: 0; }
}

/* Narrow screens: the navigation is one row that scrolls sideways instead of filling half the screen, */
/* and the bottom bar keeps its main button on its own row with the two moves beside each other under it. */
@media (max-width: 800px) {
    .nav { flex-wrap: nowrap; overflow-x: auto; flex: 1 1 100%; order: 3; padding-bottom: 4px; scrollbar-width: thin; }
    .nav a { white-space: nowrap; flex: none; }
    .review-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .review-bar [data-save-all] { order: -1; flex: 1 1 100%; }
    .review-bar > a, .review-bar > span { flex: 1 1 0; text-align: center; padding-inline: 8px; }
}

@media (max-width: 600px) {
    .brand .oo2-mark { width: 52px; }
    .card { padding: 16px; }
}

@media print {
    .oo2-mark.draw path { stroke-dashoffset: 0; animation: none; }
    .oo2-wait main.page { opacity: 1; }
    .oo2-enter { animation: none; }
}

/* الأيقونات بجانب النص (أيقونات لوسيد، css/oo2-icons.css): بلون النص ومسافة صغيرة. */
.i { margin-inline-end: 6px; color: var(--green); }
.facts dt .i, .stat .label .i { font-size: 1rem; }

/* Delete-account confirmation page: the account's facts, then what deleting does. */
.account-facts { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--round-control); background: var(--bg); display: grid; gap: 8px; }
.account-facts div { display: grid; grid-template-columns: minmax(0, 110px) minmax(0, 1fr); gap: 8px; }
.account-facts dt { color: var(--muted); }
.account-facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.delete-effects { margin: 0 0 16px; padding-inline-start: 20px; display: grid; gap: 6px; }

/* Action bar above a table (users, sites): what is selected, then the actions. */
.bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.bulk-group-label { color: var(--muted); font-size: 0.85rem; min-width: 96px; }
.bulk-actions .button { padding: 8px 14px; font-size: 0.92rem; }
.bulk-actions .button:disabled { opacity: 0.45; cursor: not-allowed; }
td.pick > input[type="checkbox"] { margin: 0 12px; }
/* A badge never breaks over lines: its coloured ground always holds its whole text. */
.badge { white-space: nowrap; }
td .badge { margin-block: 2px; }
/* Lists on the delete confirmation pages. */
.delete-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.delete-list li { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--round-control); background: var(--bg); }
.delete-list li.kept { opacity: 0.75; }

/* حقل التاريخ لا يخرج عن إطاره على الجوال (ملاحظة المستخدم في 30 نوفمبر 2026، «تاريخ الزراعة» في مراجعة الشجرة):
   لحقل التاريخ في متصفحات الجوال عرض أدنى من داخله، فيمتد أعرض من عموده. */
.form.inline > div { min-width: 0; }
.form input[type="date"], [data-tree-planting] input { display: block; min-width: 0; max-width: 100%; }
@supports (-webkit-touch-callout: none) {
    .form input[type="date"], [data-tree-planting] input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 2.75em; text-align: start; }
}

/* اختيار قالب الشهادة عند الإهداء: صور مصغرة يختار منها بالضغط. */
.template-choice { border: 1px solid var(--line); border-radius: var(--round); padding: 12px 14px; margin: 14px 0 0; }
.template-choice legend { padding: 0 6px; font-weight: 600; }
.template-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.template-option { position: relative; display: grid; gap: 4px; justify-items: center; align-content: start; text-align: center; padding: 8px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; margin: 0; font-weight: 500; }
.template-option:has(input:checked) { border-color: var(--green); background: var(--lime-tint); }
.template-option input { position: absolute; inset-inline-start: 8px; top: 8px; }
.template-option img { width: 100%; aspect-ratio: 1 / 1.4142; object-fit: contain; background: #fff; border-radius: 8px; }
.template-option img.landscape { aspect-ratio: 1.4142 / 1; }
.template-option small { color: var(--muted); }

/* رقم الشجرة عند الراعي: يظهر بجانب الرمز الرئيسي ولا يحل محله. */
.sponsor-number { font-weight: 600; font-variant-numeric: tabular-nums; }
dd .sponsor-number { margin-inline-start: 8px; color: var(--muted, #557064); font-weight: 400; }

/* صفحة دفعة الإهداء: رقم الشجرة كما كتب في الملف، وتحته رمزها الرئيسي، وكل منهما في سطر لا ينكسر. */
.tree-ref bdi { white-space: nowrap; }
.tree-ref .muted { display: block; font-size: 0.85em; }
