/* ======== خدمة الأنبا كاراس — نظام التصميم ======== */
/* خطوط عربية محلية */
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-arabic-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F; }
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-arabic-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F; }
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-arabic-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F; }
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: 'Tajawal'; src: url('../fonts/tajawal-arabic-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F; }
@font-face { font-family: 'Tajawal'; src: url('../fonts/tajawal-arabic-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F; }
@font-face { font-family: 'Tajawal'; src: url('../fonts/tajawal-arabic-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F; }
@font-face { font-family: 'Tajawal'; src: url('../fonts/tajawal-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: 'Tajawal'; src: url('../fonts/tajawal-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: 'Tajawal'; src: url('../fonts/tajawal-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF; }

:root {
    --ak-primary: #1d6fa5;
    --ak-primary-dark: #14547e;
    --ak-accent: #ea580c;
    --ak-bg: #f4f7fa;
    --ak-sidebar: #14344b;
    --ak-sidebar-hover: #1d4a6b;
    --ak-orange: #f97316;
    --ak-purple: #7c3aed;
    --bs-body-font-family: 'Tajawal', 'Cairo', system-ui, sans-serif;
}

body { font-family: 'Tajawal', 'Cairo', system-ui, sans-serif; background: var(--ak-bg); font-size: 16px; }
h1, h2, h3, h4, h5, h6, .card-header, .btn, .sidebar-brand { font-family: 'Cairo', 'Tajawal', sans-serif; }

/* ---- الهيكل ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 265px; background: var(--ak-sidebar); color: #fff; flex-shrink: 0;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.12); text-decoration: none; color: inherit;
    transition: background .15s;
}
.sidebar-brand:hover { background: rgba(255,255,255,.05); color: inherit; }
.sidebar-brand strong { color: #fff; font-family: 'Cairo', sans-serif; line-height: 1.25; display: block; }
.sidebar-brand i { font-size: 1.9rem; color: #7dd3fc; }
.sidebar-brand small { display: block; color: #9fc3d9; font-size: .78rem; }
/* شعار الخدمة */
.brand-logo {
    width: 44px; height: 44px; object-fit: contain; flex-shrink: 0;
    background: #fff; border-radius: 50%; padding: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.sidebar-nav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a, .sidebar-nav .nav-btn {
    display: flex; align-items: center; gap: .7rem; color: #d8e7f0; text-decoration: none;
    padding: .7rem .9rem; border-radius: .55rem; font-size: 1rem; border: 0; background: transparent;
    width: 100%; text-align: right; transition: background .15s;
}
.sidebar-nav a:hover, .sidebar-nav .nav-btn:hover { background: var(--ak-sidebar-hover); color: #fff; }
.sidebar-nav a.active { background: var(--ak-primary); color: #fff; font-weight: 600; }
.sidebar-nav .nav-btn { background: var(--ak-accent); color: #fff; font-weight: 700; margin: .35rem 0; justify-content: center; }
.sidebar-nav .nav-btn:hover { background: #c2410c; }
.nav-section { color: #7fa8c0; font-size: .78rem; margin: .9rem .9rem .2rem; letter-spacing: .5px; }

/* ---- مجموعة قائمة قابلة للطي (الإدارة المالية) ---- */
.sidebar-nav a.nav-group-toggle { justify-content: space-between; }
.sidebar-nav a.nav-group-toggle > span { display: flex; align-items: center; gap: .7rem; }
.nav-caret { transition: transform .18s; font-size: .8rem; opacity: .8; }
.sidebar-nav a.nav-group-toggle.collapsed .nav-caret { transform: rotate(-90deg); }
.nav-group { padding-right: .7rem; margin: 2px 0; border-right: 2px solid rgba(255,255,255,.12); }
.nav-group a { font-size: .93rem; padding: .5rem .8rem; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid #e3eaf1; padding: .8rem 1.5rem;
    display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 1.25rem; margin: 0; font-weight: 700; color: #14344b; flex: 1; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }

@media (max-width: 991px) {
    /* القائمة الجانبية خارج الشاشة عبر transform حتى لا تُنشئ تمريرًا أفقيًا */
    .sidebar {
        position: fixed; top: 0; right: 0; z-index: 1050;
        transform: translateX(100%); transition: transform .25s ease;
        height: 100dvh; max-height: 100dvh; width: min(86vw, 300px);
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.4); }
}

/* ---- بطاقات الإحصائيات ---- */
.stat-card {
    background: #fff; border-radius: .9rem; padding: 1.1rem 1.25rem; border: 1px solid #e3eaf1;
    display: flex; align-items: center; gap: 1rem; height: 100%;
}
.stat-card .icon {
    width: 52px; height: 52px; border-radius: .8rem; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}
.stat-card .num { font-size: 1.7rem; font-weight: 700; font-family: 'Cairo', sans-serif; line-height: 1.1; }
.stat-card .lbl { color: #64748b; font-size: .9rem; }
/* بطاقة قابلة للنقر (رابط) */
a.stat-card, a .stat-card { transition: box-shadow .15s, transform .15s, border-color .15s; }
a.stat-card { cursor: pointer; }
a.stat-card:hover, a:hover > .stat-card { box-shadow: 0 .5rem 1.1rem rgba(15,23,42,.1); transform: translateY(-2px); border-color: #bcd3e6; }
a.stat-card:focus-visible, a:focus-visible > .stat-card { outline: 2px solid var(--ak-blue, #1d6fa5); outline-offset: 2px; }
/* مؤشر النقر للرسوم البيانية */
canvas.chart-clickable { cursor: pointer; }

/* ---- ألوان الحالات (بند 25) ---- */
.badge.bg-orange { background-color: var(--ak-orange) !important; color: #fff; }
.badge.bg-purple { background-color: var(--ak-purple) !important; color: #fff; }
.text-orange { color: var(--ak-orange) !important; }
.text-purple { color: var(--ak-purple) !important; }
.bg-orange-subtle { background-color: #ffedd5 !important; }
.bg-purple-subtle { background-color: #ede9fe !important; }

/* ---- شريط مراحل الحالة ---- */
.stage-bar { display: flex; gap: 0; overflow-x: auto; background: #fff; border: 1px solid #e3eaf1; border-radius: .9rem; padding: .9rem 1rem; }
.stage-step { display: flex; align-items: center; gap: .45rem; color: #94a3b8; white-space: nowrap; font-size: .92rem; }
.stage-step .dot {
    width: 30px; height: 30px; border-radius: 50%; background: #e2e8f0; color: #64748b;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.stage-step.done .dot { background: #16a34a; color: #fff; }
.stage-step.current .dot { background: var(--ak-primary); color: #fff; box-shadow: 0 0 0 4px #bfdcf0; }
.stage-step.done, .stage-step.current { color: #1e293b; font-weight: 600; }
.stage-sep { flex: 1 0 24px; height: 3px; background: #e2e8f0; margin: 0 .5rem; border-radius: 2px; align-self: center; min-width: 18px; }
.stage-sep.done { background: #16a34a; }

/* ---- الفورم متعدد الخطوات ---- */
.wizard-steps { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.wizard-steps a {
    padding: .5rem .85rem; border-radius: 2rem; background: #fff; border: 1px solid #dbe4ec;
    color: #475569; text-decoration: none; font-size: .88rem; transition: all .15s;
}
.wizard-steps a.active { background: var(--ak-primary); color: #fff; border-color: var(--ak-primary); font-weight: 700; }
.wizard-steps a.filled { border-color: #16a34a; color: #16a34a; }

/* ---- عام ---- */
.card { border: 1px solid #e3eaf1; border-radius: .9rem; }
.card-header { background: #fff; border-bottom: 1px solid #eef2f6; font-weight: 700; color: #14344b; padding: .9rem 1.25rem; }
.btn { border-radius: .55rem; padding: .5rem 1.1rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; font-weight: 700; }
.btn-primary { background: var(--ak-primary); border-color: var(--ak-primary); }
.btn-primary:hover { background: var(--ak-primary-dark); border-color: var(--ak-primary-dark); }
.btn-accent { background: var(--ak-accent); border-color: var(--ak-accent); color: #fff; font-weight: 700; }
.btn-accent:hover { background: #c2410c; color: #fff; }
.form-label { font-weight: 600; color: #334155; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: .55rem; padding: .55rem .8rem; border-color: #cbd8e2; }
.form-control:focus, .form-select:focus { border-color: var(--ak-primary); box-shadow: 0 0 0 3px rgba(29,111,165,.18); }
.table thead th { background: #f1f5f9; color: #334155; font-weight: 700; white-space: nowrap; }
.table td { vertical-align: middle; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--ak-primary); outline-offset: 2px; }

/* مراحل الحالة القابلة للنقر — بدون أي مربع يحيط بالكلمة */
.stage-link { cursor: pointer; background: none; border: 0; box-shadow: none; -webkit-appearance: none; appearance: none; font: inherit; text-decoration: none; padding: 0; transition: color .15s, transform .1s; }
.stage-link:hover { background: none; transform: translateY(-1px); }
.stage-link:hover .dot { box-shadow: 0 0 0 3px #cfe3f1; }
.stage-link:focus, .stage-link:focus-visible { outline: none; box-shadow: none; }
.stage-link:focus-visible .dot { box-shadow: 0 0 0 3px var(--ak-primary); }
a.stage-link, button.stage-link { color: inherit; background: none; }

/* نسبة الاستكمال */
.completion-ring { font-weight: 700; font-family: 'Cairo'; }

/* صفحة الدخول */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #14344b 0%, #1d6fa5 100%); padding: 1rem;
}
.login-card { background: #fff; border-radius: 1.2rem; padding: 2.5rem 2.2rem; width: 100%; max-width: 440px; box-shadow: 0 25px 60px rgba(0,0,0,.35); }
.login-card .brand-icon { width: 74px; height: 74px; border-radius: 50%; background: #e0f2fe; color: var(--ak-primary); font-size: 2.2rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }

/* ======== صفحة الهبوط الأساسية ======== */
:root { --ak-gold: #c8912b; --ak-gold-light: #e6b654; }
.landing {
    position: relative; min-height: 100vh; min-height: 100svh; width: 100%; overflow: hidden;
    display: flex; flex-direction: column;
    background: #1a1206 url('../img/hero-landing.webp') center right / cover no-repeat;
}
/* تدرّج داكن من جهة النص (يمين) ليصبح النص واضحًا مع إبقاء الصورة ظاهرة */
.landing::before {
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background:
        linear-gradient(to left, rgba(20,14,4,.86) 0%, rgba(20,14,4,.62) 34%, rgba(20,14,4,.12) 62%, rgba(20,14,4,0) 100%),
        linear-gradient(to top, rgba(20,14,4,.55) 0%, rgba(20,14,4,0) 45%);
}
.landing__bar {
    position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 1.15rem clamp(1rem, 4vw, 3rem); color: #fff;
}
.landing__brand { display: flex; align-items: center; gap: .7rem; font-family: 'Cairo', sans-serif; }
.landing__brand i { font-size: 1.9rem; color: var(--ak-gold-light); filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.landing__logo { width: 46px; height: 46px; object-fit: contain; flex-shrink: 0; background: #fff; border-radius: 50%; padding: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.landing__brand strong { font-size: 1.15rem; font-weight: 700; line-height: 1.15; display: block; }
.landing__brand small { color: #e9d7b0; font-size: .8rem; }
.landing__login-link {
    color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem;
    border: 1px solid rgba(255,255,255,.4); border-radius: 2rem; padding: .5rem 1.2rem;
    display: inline-flex; align-items: center; gap: .45rem; transition: background .2s, border-color .2s;
    white-space: nowrap;
}
.landing__login-link:hover { background: rgba(255,255,255,.14); border-color: #fff; color: #fff; }

.landing__body {
    position: relative; z-index: 2; flex: 1; display: flex; align-items: center;
    padding: 1rem clamp(1rem, 4vw, 3rem) clamp(2rem, 6vh, 4rem);
}
.landing__content { max-width: 640px; color: #fff; }
.landing__eyebrow {
    display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 1.1rem;
    background: rgba(200,145,43,.18); border: 1px solid rgba(230,182,84,.5);
    color: #f4e3bd; font-family: 'Cairo', sans-serif; font-weight: 600; font-size: 1.05rem;
    padding: .45rem 1.1rem; border-radius: 2rem; backdrop-filter: blur(3px);
}
.landing__eyebrow i { color: var(--ak-gold-light); }
.landing__title {
    font-family: 'Cairo', sans-serif; font-weight: 700; color: #fff;
    font-size: clamp(2.1rem, 6vw, 4rem); line-height: 1.15; margin: 0 0 1rem;
    text-shadow: 0 3px 18px rgba(0,0,0,.55);
}
.landing__title .accent { color: var(--ak-gold-light); }
.landing__desc {
    font-size: clamp(1.05rem, 2.4vw, 1.4rem); color: #f0ebe0; line-height: 1.7;
    margin: 0 0 2rem; max-width: 34em; text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.landing__actions { display: flex; flex-wrap: wrap; gap: .9rem 1.1rem; align-items: center; }
.btn-gold {
    background: linear-gradient(135deg, var(--ak-gold-light) 0%, var(--ak-gold) 100%);
    color: #2a1c05; border: 0; text-decoration: none; font-weight: 700; font-family: 'Cairo', sans-serif;
    border-radius: .7rem; padding: .95rem 1.9rem; font-size: 1.1rem;
    display: inline-flex; align-items: center; gap: .6rem; min-height: 52px;
    box-shadow: 0 12px 30px rgba(200,145,43,.4); transition: transform .18s, box-shadow .18s, filter .18s;
}
.btn-gold:hover, .btn-gold:focus { text-decoration: none; }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(200,145,43,.55); filter: brightness(1.05); color: #2a1c05; }
.btn-gold:active { transform: translateY(0); }
.landing__note { color: #d9cfbb; font-size: .92rem; display: inline-flex; align-items: center; gap: .4rem; }

.landing__content { animation: landingRise .8s cubic-bezier(.2,.7,.2,1) both; }
@keyframes landingRise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

.landing :focus-visible { outline: 3px solid var(--ak-gold-light); outline-offset: 3px; border-radius: .4rem; }

@media (max-width: 767px) {
    .landing { background-position: center center; }
    .landing::before {
        background:
            linear-gradient(to top, rgba(20,14,4,.9) 8%, rgba(20,14,4,.5) 55%, rgba(20,14,4,.25) 100%);
    }
    .landing__body { align-items: flex-end; }
    .landing__brand small { display: none; }
}

/* ======== صفحة تسجيل الدخول (تصميم مقسوم — النصوص HTML قابلة للتعديل) ======== */
.auth { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; background: #0f2438; }
.auth__body { flex: 1; display: flex; min-height: 0; }

/* جهة الصورة (اليسار في RTL) */
.auth__hero {
    position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden;
    background: #14344b url('../img/login-hero.webp') center top / cover no-repeat;
    display: flex; flex-direction: column; justify-content: center;
}
.auth__hero::before {
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background:
        linear-gradient(90deg, rgba(15,36,56,.80) 0%, rgba(15,36,56,.40) 45%, rgba(15,36,56,.10) 100%),
        linear-gradient(to top, rgba(15,36,56,.80), rgba(15,36,56,0) 42%);
}
.auth__hero-inner { position: relative; z-index: 2; padding: clamp(1.5rem, 4vw, 3.5rem); color: #fff; max-width: 620px; }
.auth__title { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: clamp(1.9rem, 4vw, 3.3rem); line-height: 1.2; margin: 0 0 .6rem; text-shadow: 0 3px 18px rgba(0,0,0,.55); }
.auth__title .accent { color: var(--ak-gold-light, #e6b654); }
.auth__subtitle { font-family: 'Cairo', sans-serif; font-size: clamp(1rem, 2.2vw, 1.5rem); color: #f2e8d0; margin: 0; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.auth__sep { display: flex; align-items: center; gap: .6rem; color: var(--ak-gold-light, #e6b654); margin: 1.1rem 0 0; font-size: 1.5rem; }
.auth__sep::before, .auth__sep::after { content: ''; height: 1px; flex: 0 0 55px; background: linear-gradient(90deg, transparent, var(--ak-gold-light, #e6b654)); }

/* جهة النموذج (اليمين في RTL) */
.auth__panel { flex: 0 0 480px; max-width: 100%; display: flex; align-items: center; justify-content: center; padding: clamp(1.5rem, 3vw, 2.5rem); background: #fff; }
.auth__card { width: 100%; max-width: 400px; }
.auth__logo { width: 104px; height: 104px; margin: 0 auto 1rem; border-radius: 50%; background: linear-gradient(135deg, #f6efdd, #efe1c2); display: flex; align-items: center; justify-content: center; color: var(--ak-gold, #c8912b); font-size: 2.3rem; box-shadow: 0 8px 22px rgba(200,145,43,.25); padding: 6px; }
.auth__logo img { width: 100%; height: 100%; object-fit: contain; }
.auth__brand { text-align: center; font-family: 'Cairo', sans-serif; font-weight: 700; color: #14344b; font-size: 1.35rem; line-height: 1.3; margin-bottom: .3rem; }
.auth__brand .accent { color: var(--ak-gold, #c8912b); }
.auth__heading { text-align: center; font-family: 'Cairo', sans-serif; font-weight: 700; color: #14344b; margin: 1.2rem 0 .2rem; }
.auth__divider { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--ak-gold, #c8912b); margin-bottom: 1.3rem; }
.auth__divider::before, .auth__divider::after { content: ''; height: 1px; width: 46px; background: linear-gradient(90deg, transparent, var(--ak-gold, #c8912b)); }
.auth .input-group-text { background: #f8fafc; border-color: #cbd8e2; color: #64748b; }
.auth .btn-login { background: #14344b; border: 0; color: #fff; font-weight: 700; font-family: 'Cairo', sans-serif; padding: .8rem; border-radius: .6rem; font-size: 1.05rem; }
.auth .btn-login:hover { background: #0f2740; color: #fff; }
.auth__or { text-align: center; color: #94a3b8; margin: 1rem 0; position: relative; }
.auth__or::before, .auth__or::after { content: ''; position: absolute; top: 50%; width: 38%; height: 1px; background: #e3eaf1; }
.auth__or::before { right: 0; } .auth__or::after { left: 0; }
.btn-church { width: 100%; border: 1px solid #cbd8e2; background: #fff; color: #14344b; font-weight: 600; border-radius: .6rem; padding: .7rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none; }
.btn-church:hover { background: #f4f7fa; border-color: var(--ak-primary); color: #14344b; }

/* شريط الآية أسفل الصفحة */
.auth__footer { background: #0f2438; color: #e9dcc0; text-align: center; padding: .9rem 1rem; font-size: .95rem; border-top: 1px solid rgba(230,182,84,.25); }

/* الجوّال: تكديس عمودي — الصورة أعلى مختصرة والنموذج أسفل */
@media (max-width: 991px) {
    .auth__body { flex-direction: column; }
    .auth__hero { flex: none; min-height: 34vh; background-position: center 30%; }
    .auth__hero-inner { padding: 1.25rem; }
    .auth__panel { flex: none; width: 100%; }
}

/* الطباعة */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .content { padding: 0; max-width: 100%; }
    body { background: #fff; font-size: 13px; }
    .card { border: 1px solid #ccc; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ================= وحدة الإدارة المالية ================= */

/* شريط خطوات المعالج */
.wizard-steps { display: flex; gap: .5rem; overflow-x: auto; }
.wizard-step {
    display: flex; align-items: center; gap: .5rem; padding: .5rem .9rem; border-radius: .6rem;
    color: #94a3b8; white-space: nowrap; font-size: .92rem; background: #f8fafc; border: 1px solid #e3eaf1; flex: 1;
}
.wizard-step .wizard-num {
    width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; color: #64748b;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.wizard-step.current { color: var(--ak-primary); border-color: var(--ak-primary); background: #fff; font-weight: 600; }
.wizard-step.current .wizard-num { background: var(--ak-primary); color: #fff; }
.wizard-step.done { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; cursor: pointer; }
.wizard-step.done .wizard-num { background: #16a34a; color: #fff; }
@media (max-width: 768px) { .wizard-step .wizard-label { display: none; } .wizard-step { flex: 0 0 auto; } }

/* بطاقات اختيار نوع المعاملة */
.type-card {
    display: flex; align-items: center; gap: .7rem; width: 100%; cursor: pointer;
    border: 1px solid #e3eaf1; border-radius: .8rem; padding: .8rem; background: #fff;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.type-card:hover { border-color: #bcd3e6; box-shadow: 0 .35rem .9rem rgba(15,23,42,.08); transform: translateY(-1px); }
.type-card.selected { border-color: var(--ak-primary); box-shadow: 0 0 0 2px rgba(29,111,165,.18); }
.type-card .type-icon {
    width: 42px; height: 42px; border-radius: .6rem; display: flex; align-items: center;
    justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.type-card .type-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.type-card .type-label { font-weight: 600; color: #14344b; }
.type-card .type-dir { font-size: .7rem; align-self: flex-start; }

/* أزرار الإجراءات الثابتة أسفل الشاشة */
.sticky-actions { position: sticky; bottom: 1rem; z-index: 20; box-shadow: 0 -.3rem 1rem rgba(15,23,42,.08); }

/* الخط الزمني للمعاملة */
.fin-timeline { list-style: none; margin: 0; padding: 0 1.1rem 0 0; border-right: 2px solid #e3eaf1; }
.fin-timeline li { position: relative; padding: 0 1rem .95rem 0; }
.fin-timeline li::before {
    content: ''; position: absolute; right: -1.42rem; top: .35rem; width: 11px; height: 11px;
    border-radius: 50%; background: var(--ak-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px #e3eaf1;
}
.fin-timeline li:last-child { padding-bottom: 0; }
.fin-timeline .tl-time { color: #94a3b8; font-size: .8rem; }

/* بطاقة ملخص المعاملة */
.fin-hero { border-radius: .9rem; padding: 1.2rem 1.4rem; color: #fff; }
.fin-hero.in { background: linear-gradient(135deg, #16a34a, #15803d); }
.fin-hero.out { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.fin-hero .fin-amount { font-size: 2.1rem; font-weight: 800; font-family: 'Cairo', sans-serif; line-height: 1.1; }

/* =====================================================================
   تحسينات نسخة الموبايل — أهداف لمس ≥44px، بلا تمرير أفقي، بيانات مقروءة
   ===================================================================== */

/* منع أي تمرير أفقي عرَضي.
   ملاحظة: لا نستخدم overflow-x:hidden على html/body لأنه يُعطّل position:sticky
   للقائمة الجانبية على سطح المكتب — المصدر الحقيقي للفيض عُولج بـ transform. */
html, body { max-width: 100%; }
/* على الموبايل فقط: القائمة الجانبية fixed خارج الشاشة، وعناصر fixed لا يقصّها body
   وحده — لذا نمنع التمرير الأفقي على html أيضًا. لا يؤثر على سطح المكتب حيث
   تعتمد القائمة على position:sticky. */
@media (max-width: 991px) { html, body { overflow-x: hidden; } }

/* إلغاء تأخير اللمس 300ms */
a, button, .btn, select, input[type="checkbox"], input[type="radio"], [role="button"] { touch-action: manipulation; }

/* ستارة تعتيم خلف القائمة الجانبية على الموبايل */
.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1040;
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }
@media (min-width: 992px) { .sidebar-backdrop { display: none; } }

@media (max-width: 991px) {
    /* مساحات أنسب للشاشات الصغيرة */
    .content { padding: 1rem .85rem calc(1.25rem + env(safe-area-inset-bottom)); }
    .topbar { padding: .7rem .9rem; gap: .5rem; }
    /* العنوان لا يلتف لأكثر من سطر ولا يزاحم الأزرار */
    .topbar-title {
        font-size: 1.02rem; white-space: nowrap; overflow: hidden;
        text-overflow: ellipsis; min-width: 0; flex: 1 1 auto;
    }
    .topbar-actions { flex: 0 0 auto; gap: .35rem; }
    .topbar-actions .btn { min-width: 44px; }
    /* على الموبايل نُخفي اسم المستخدم (يظهر داخل القائمة) لإفساح المجال للعنوان */
    .topbar-actions .user-name { display: none; }
    .topbar-actions .dropdown-toggle::after { margin-inline-start: .15rem; }
    .card-body { padding: .95rem; }
    .card-header { padding: .75rem .95rem; }

    /* ===== أهداف اللمس: 44px حد أدنى ===== */
    .sidebar-nav a, .sidebar-nav .nav-btn { min-height: 48px; padding: .8rem .9rem; }
    .nav-group a { min-height: 44px; }

    .btn { min-height: 44px; padding-block: .55rem; }
    .btn-sm { min-height: 44px; padding-block: .5rem; font-size: .95rem; }
    /* الأزرار الأيقونية داخل الجداول */
    .table .btn, .table .btn-sm { min-width: 44px; }
    /* مسافة بين الأزرار المتلاصقة */
    .table td .d-flex.gap-1 { gap: .5rem !important; }
    .btn-group > .btn { min-height: 44px; }

    /* ترقيم الصفحات */
    .pagination .page-link { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    .pagination { flex-wrap: wrap; gap: .25rem; justify-content: center; }

    /* مفاتيح التبديل وصناديق الاختيار أكبر */
    .form-check-input { width: 1.35em; height: 1.35em; margin-top: .1em; }
    .form-check-input[type="checkbox"], .form-check-input[type="radio"] { min-width: 22px; min-height: 22px; }
    .form-switch .form-check-input { width: 2.6em; height: 1.35em; }
    .form-check-label { padding-inline-start: .25rem; min-height: 24px; }

    /* ===== الحقول: 16px لمنع تكبير iOS التلقائي عند التركيز ===== */
    .form-control, .form-select, input, select, textarea,
    .form-control-sm, .form-select-sm { font-size: 16px !important; }
    .form-control, .form-select { min-height: 46px; }
    .form-control-sm, .form-select-sm { min-height: 42px; padding: .45rem .7rem; }
    textarea.form-control { min-height: 90px; }
    .form-label { font-size: .9rem; margin-bottom: .25rem; }
    .input-group > .form-control, .input-group > .form-select { min-height: 46px; }

    /* ===== الجداول: تمرير أفقي سلس مع ظل يدل على وجود أعمدة مخفية ===== */
    .table-responsive {
        -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: thin;
        /* ظلال تمرير: تظهر تلقائيًا عند وجود محتوى خارج الشاشة وتختفي عند النهاية */
        background:
            linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) left center,
            linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) right center,
            linear-gradient(to left, rgba(15,23,42,.12), rgba(255,255,255,0)) left center,
            linear-gradient(to right, rgba(15,23,42,.12), rgba(255,255,255,0)) right center;
        background-repeat: no-repeat;
        background-size: 26px 100%, 26px 100%, 12px 100%, 12px 100%;
        background-attachment: local, local, scroll, scroll;
    }
    .table { font-size: .92rem; }
    .table th, .table td { white-space: nowrap; padding: .65rem .5rem; vertical-align: middle; }
    /* السماح بالالتفاف في أعمدة النص الطويل فقط */
    .table td.small, .table td.wrap { white-space: normal; min-width: 150px; }
    /* توسيع مساحة اللمس لروابط النص (جداول، بطاقات، قوائم) دون تغيير الشكل المرئي */
    .table td a:not(.btn), .list-group-item a:not(.btn), .card-body a.fw-bold:not(.btn) {
        display: inline-block; padding-block: .8rem; margin-block: -.8rem;
    }

    /* ===== بطاقات الإحصائيات: أرقام لا تفيض ===== */
    .stat-card { padding: .85rem .9rem; gap: .7rem; }
    .stat-card .icon { width: 42px; height: 42px; font-size: 1.15rem; border-radius: .65rem; }
    .stat-card .num { font-size: clamp(1.05rem, 5.2vw, 1.45rem); overflow-wrap: anywhere; }
    .stat-card .lbl { font-size: .8rem; line-height: 1.3; }
    .stat-card > div:last-child { min-width: 0; }

    /* ===== القوائم المنسدلة لا تتجاوز الشاشة ===== */
    .dropdown-menu { max-width: calc(100vw - 1.6rem); }
    .dropdown-item { min-height: 44px; display: flex; align-items: center; gap: .5rem; }

    /* ===== الرسوم البيانية ===== */
    .card-body > canvas { min-height: 220px; max-height: 300px; }

    /* ===== شريط المراحل والمعالج ===== */
    .stage-bar { padding: .7rem .6rem; }
    .stage-step { font-size: .85rem; }
    .wizard-steps { gap: .35rem; }

    /* ===== أزرار الإجراءات الثابتة أسفل الشاشة ===== */
    .sticky-actions { bottom: 0; border-radius: .9rem .9rem 0 0; margin-inline: -.85rem; }
    .sticky-actions .card-body { padding: .75rem .85rem calc(.75rem + env(safe-area-inset-bottom)); }
    .sticky-actions .btn { flex: 1 1 auto; }

    /* ===== بطاقات اختيار النوع في المعالج ===== */
    .type-card { padding: .7rem; min-height: 64px; }
    .type-card .type-icon { width: 38px; height: 38px; font-size: 1.05rem; }
    .type-card .type-label { font-size: .92rem; }

    /* ===== التنبيهات والشارات ===== */
    .alert { padding: .8rem .9rem; font-size: .92rem; }
    .badge { font-size: .78rem; }

    /* منع فيض النصوص الطويلة (روابط/أكواد) */
    .card, .alert, .list-group-item { overflow-wrap: anywhere; }
}

/* الهواتف الصغيرة جدًا (≤380px) */
@media (max-width: 380px) {
    .content { padding: .8rem .6rem calc(1rem + env(safe-area-inset-bottom)); }
    .stat-card { padding: .7rem .75rem; }
    .stat-card .icon { width: 38px; height: 38px; }
    .stat-card .num { font-size: clamp(1rem, 5.5vw, 1.3rem); }
    .table { font-size: .88rem; }
    .btn { font-size: .95rem; }
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .sidebar { transition: none; }
}

@media (max-width: 991px) {
    .brand-logo { width: 40px; height: 40px; }
    .sidebar-brand { padding: .95rem .9rem; }
    .auth__logo { width: 88px; height: 88px; }
    .landing__logo { width: 40px; height: 40px; }
}

/* ---- الموبايل: تثبيت العمود الأول (المُعرِّف) أثناء التمرير الأفقي ---- */
@media (max-width: 991px) {
    .table-responsive > .table > thead > tr > th:first-child,
    .table-responsive > .table > tbody > tr > td:first-child {
        position: sticky; right: 0; z-index: 1;
        background-color: #fff;
        background-image: linear-gradient(var(--bs-table-bg, transparent), var(--bs-table-bg, transparent));
        box-shadow: -6px 0 8px -6px rgba(15,23,42,.18);
    }
    .table-responsive > .table > thead > tr > th:first-child { background-color: #f8fafc; z-index: 3; }
    /* الصفوف الملوّنة (تحذير/خطر/نجاح) تحتفظ بلونها في العمود المثبت */
    .table-responsive > .table > tbody > tr.table-danger > td:first-child { background-color: #f8d7da; }
    .table-responsive > .table > tbody > tr.table-warning > td:first-child { background-color: #fff3cd; }
    .table-responsive > .table > tbody > tr.table-success > td:first-child { background-color: #d1e7dd; }
    .table-responsive > .table > tbody > tr.table-secondary > td:first-child { background-color: #e2e3e5; }
    .table-responsive > .table > tbody > tr.table-light > td:first-child { background-color: #fcfcfd; }
    /* صفوف الطي (تفاصيل التعديل) تمتد بعرض الجدول فلا تُثبَّت */
    .table-responsive > .table > tbody > tr.collapse > td:first-child,
    .table-responsive > .table > tbody > tr.collapsing > td:first-child { position: static; box-shadow: none; }
}

/* ═══════════════════════════════════════════════════════════
   استمارات البحث — النسخة المعدَّلة (نوع الحالة، السكن، الممتلكات، الأمراض)
   ═══════════════════════════════════════════════════════════ */

/* بطاقات اختيار نوع البحث (مشروع / عروسة / مساعدات أخرى) */
.case-type {
    position: relative; display: block; height: 100%; cursor: pointer; background: #fff;
    border: 2px solid #e3eaf1; border-radius: .9rem; padding: 1.1rem; transition: .15s;
}
.case-type:hover { border-color: #bcd3e6; box-shadow: 0 .35rem .9rem rgba(15,23,42,.08); }
.case-type input { position: absolute; opacity: 0; pointer-events: none; }
.case-type .ct-ic {
    width: 52px; height: 52px; border-radius: .75rem; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem; margin-bottom: .7rem;
}
.case-type .ct-name { display: block; font-weight: 700; font-size: 1.05rem; color: #14344b; }
.case-type .ct-desc { display: block; font-size: .85rem; color: #64748b; line-height: 1.7; margin-top: .35rem; }
.case-type .ct-meta { display: block; font-size: .78rem; color: #94a3b8; margin-top: .6rem; }
.case-type .ct-flag { position: absolute; top: .7rem; left: .7rem; font-size: .7rem; }
.case-type.soon { opacity: .62; }
.case-type.t1:has(input:checked) { border-color: #1d4ed8; background: #f5f9ff; box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.case-type.t2:has(input:checked) { border-color: #a21caf; background: #fdf6ff; box-shadow: 0 0 0 3px rgba(162,28,175,.12); }
.case-type.t3:has(input:checked) { border-color: #c2410c; background: #fff8f3; box-shadow: 0 0 0 3px rgba(194,65,12,.12); }

/* الملء التلقائي من ملف الكنيسة */
.autofilled { background: #f0fdf4 !important; border-color: #86efac !important; transition: background .4s, border-color .4s; }
.autofill-note { display: none; }
.autofill-note.show { display: inline-flex; }
.newpriest-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: .7rem; }

/* تنبيه الأقسام المنقولة */
.moved-note { background: #fef2f2; border: 1px dashed #fca5a5; border-radius: .7rem; }

/* تقييم السكن — أربع بطاقات بوصف كل درجة */
.rate-card {
    display: block; height: 100%; cursor: pointer; background: #fff;
    border: 2px solid #e3eaf1; border-radius: .8rem; padding: .85rem; transition: .15s;
}
.rate-card:hover { border-color: #93c5fd; background: #f8fbff; }
.rate-card input { position: absolute; opacity: 0; pointer-events: none; }
.rate-card .rt { font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: .4rem; }
.rate-card .rd { display: block; font-size: .83rem; color: #64748b; margin-top: .35rem; line-height: 1.6; }
.rate-card .dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.rate-card:has(input:checked) { box-shadow: 0 .3rem .9rem rgba(15,23,42,.08); }
.rc-good:has(input:checked)  { border-color: #16a34a; background: #f0fdf4; }
.rc-acc:has(input:checked)   { border-color: #f59e0b; background: #fffbeb; }
.rc-poor:has(input:checked)  { border-color: #f97316; background: #fff7ed; }
.rc-unfit:has(input:checked) { border-color: #dc2626; background: #fef2f2; }

/* ملك / شراكة */
.ten-card {
    display: block; cursor: pointer; background: #fff; transition: .15s;
    border: 2px solid #e3eaf1; border-radius: .7rem; padding: .7rem .9rem;
}
.ten-card:hover { border-color: #93c5fd; background: #f8fbff; }
.ten-card input { position: absolute; opacity: 0; pointer-events: none; }
.ten-card:has(input:checked) { border-color: var(--ak-primary, #1d6fa5); background: #eff6ff; }
.ten-card .tt { font-weight: 700; }
.ten-card .td { font-size: .82rem; color: #64748b; }

/* الأمراض المزمنة الشائعة */
.dz-chk {
    border: 1px solid #e3eaf1; border-radius: .6rem; padding: .55rem .7rem;
    background: #fff; cursor: pointer; transition: .15s;
}
.dz-chk:hover { border-color: #93c5fd; background: #f8fbff; }
.dz-chk:has(input:checked) { border-color: var(--ak-primary, #1d6fa5); background: #eff6ff; }
.dz-chk input:checked ~ span { font-weight: 700; color: var(--ak-primary, #1d6fa5); }

/* اليومية: تُسجَّل للعِلم فقط */
.daily-box { background: #f0fdf4; border: 1px solid #86efac; border-radius: .7rem; }

@media (max-width: 991px) {
    .case-type { padding: .9rem; }
    .case-type .ct-ic { width: 44px; height: 44px; font-size: 1.25rem; }
}

/* ═══════════ استمارة العروسة: بنود الجهاز ═══════════ */
.jz-item {
    display: flex; align-items: center; gap: .7rem;
    border: 1px solid #e3eaf1; border-radius: .7rem; padding: .6rem .8rem; background: #fff;
    transition: border-color .15s, background .15s;
}
.jz-item .nm { flex: 1; font-weight: 600; font-size: .93rem; margin: 0; cursor: pointer; }
.jz-item .jz-price { max-width: 96px; }
.jz-item.miss { border-color: #fca5a5; background: #fef2f2; }
.jz-item.have { border-color: #86efac; background: #f0fdf4; }
.jahaz-sum { background: #fdf4ff; border: 1px solid #f5d0fe; border-radius: .8rem; }

/* ═══════════ مساعدات أخرى: نوع المساعدة ودرجة الاستعجال ═══════════ */
.kind-card {
    display: block; height: 100%; text-align: center; cursor: pointer; background: #fff;
    border: 2px solid #e3eaf1; border-radius: .8rem; padding: .8rem .5rem; transition: .15s;
}
.kind-card:hover { border-color: #fdba74; background: #fff9f4; }
.kind-card input { position: absolute; opacity: 0; pointer-events: none; }
.kind-card:has(input:checked) { border-color: #ea580c; background: #fff7ed; }
.kind-card .e { font-size: 1.5rem; display: block; margin-bottom: .25rem; }
.kind-card .n { font-weight: 700; font-size: .9rem; }

.urg-card {
    display: block; cursor: pointer; background: #fff; transition: .15s;
    border: 2px solid #e3eaf1; border-radius: .7rem; padding: .6rem .8rem;
}
.urg-card input { position: absolute; opacity: 0; pointer-events: none; }
.urg-card.u1:has(input:checked) { border-color: #16a34a; background: #f0fdf4; }
.urg-card.u2:has(input:checked) { border-color: #f59e0b; background: #fffbeb; }
.urg-card.u3:has(input:checked) { border-color: #dc2626; background: #fef2f2; }

@media (max-width: 575px) {
    .jz-item { flex-wrap: wrap; }
    .jz-item .jz-price { max-width: 100%; width: 100%; }
}
