/* ═══════════════ ARCO Group — نظام التصميم ═══════════════
   تركوازي (Teal) + رماديات باردة · بطاقات · ظلال خفيفة · جوال أولاً */

:root {
    --brand: #599b9f;          /* teal — اللون الأساسي */
    --brand-dark: #45797d;
    --brand-soft: #d9eaeb;
    --brand-softer: #eef5f5;
    --ink: #2e3a3b;            /* رمادي داكن بارد */
    --ink-2: #5f7173;
    --ink-3: #93a3a4;
    --paper: #f6f9f9;          /* خلفية */
    --card: #ffffff;
    --line: #e2ebeb;
    --ok: #3e7d5a;
    --ok-soft: #e3f0e9;
    --warn: #b5852f;
    --warn-soft: #f7edd8;
    --bad: #b04438;
    --bad-soft: #f8e5e2;
    --radius: 1rem;
    --shadow: 0 1px 2px rgba(46, 58, 59, .05), 0 4px 14px rgba(46, 58, 59, .06);
}

html { font-size: 15.5px; }

body {
    font-family: "Almarai", system-ui, sans-serif;
    background: var(--paper);
    color: var(--ink);
    padding-bottom: 76px; /* مساحة الشريط السفلي في الجوال */
}
@media (min-width: 992px) { body { padding-bottom: 0; } }

/* ─── الشريط العلوي ─── */
.topbar {
    background: rgba(246, 249, 249, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    min-height: 60px;
}
.brand-mark {
    width: 38px; height: 38px; display: inline-flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #6cadb1, var(--brand-dark));
    color: #fff;
    border-radius: .7rem; font-size: 1.15rem;
    box-shadow: 0 3px 8px rgba(89, 155, 159, .35);
}
.brand-name {
    font-weight: 800; font-size: 1.14rem; color: var(--ink);
    letter-spacing: .04em; line-height: 1;
}
.brand-name .brand-sub {
    color: var(--brand); font-weight: 700; font-size: .82em;
}
.brand-tagline {
    display: block; font-size: .62rem; font-weight: 400;
    color: var(--ink-3); letter-spacing: .12em; margin-top: .15rem;
}
.top-links a {
    color: var(--ink-2); text-decoration: none; font-weight: 500;
    padding: .45rem .8rem; border-radius: .6rem; font-size: .93rem;
    transition: all .15s;
}
.top-links a:hover { background: var(--brand-softer); color: var(--brand-dark); }
.top-links a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.top-links a i { margin-inline-end: .2rem; }

/* ─── الشريط السفلي (جوال) ─── */
.bottom-nav {
    position: fixed; bottom: 0; inset-inline: 0; z-index: 1030;
    display: flex; justify-content: space-around;
    background: rgba(255, 255, 255, .95); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: .1rem;
    color: var(--ink-3); text-decoration: none; font-size: .68rem;
    font-weight: 500; padding: .25rem .6rem; border-radius: .6rem; flex: 1;
    max-width: 84px; transition: color .15s;
}
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--brand); font-weight: 700; }

/* ─── البطاقات ─── */
.soft-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card, .soft-card.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* بطاقة إحصائية */
.stat-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: .9rem 1rem;
}
.stat-card .stat-label { font-size: .78rem; color: var(--ink-2); font-weight: 500; }
.stat-card .stat-value { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: .7rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.tone-brand .stat-icon { background: var(--brand-soft); color: var(--brand-dark); }
.tone-ok .stat-icon { background: var(--ok-soft); color: var(--ok); }
.tone-warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
.tone-bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.tone-ok .stat-value { color: var(--ok); }
.tone-warn .stat-value { color: var(--warn); }
.tone-bad .stat-value { color: var(--bad); }

/* ─── الأزرار ─── */
.btn-brand {
    background: var(--brand); border: none; color: #fff; font-weight: 700;
    border-radius: .7rem;
}
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); color: #fff; }
.btn-soft {
    background: var(--brand-softer); color: var(--brand-dark);
    border: 1px solid var(--brand-soft); font-weight: 600; border-radius: .7rem;
}
.btn-soft:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-outline-secondary, .btn-outline-danger { border-radius: .7rem; }

/* ─── الجداول ─── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table { --bs-table-hover-bg: var(--brand-softer); margin-bottom: 0; }
.table thead th {
    background: #eef4f4; color: var(--ink-2); font-size: .78rem;
    font-weight: 700; border-bottom: 1px solid var(--line);
    white-space: nowrap; padding: .65rem .75rem;
}
.table tbody td { padding: .65rem .75rem; vertical-align: middle; border-color: var(--line); }
.table tfoot td { background: var(--brand-softer); font-weight: 800; border-top: 2px solid var(--brand-soft); }

/* ─── التبويبات ─── */
.pill-tabs {
    display: flex; gap: .35rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: .25rem; background: #e8f0f0; border-radius: .85rem;
    scrollbar-width: none;
}
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tabs a {
    white-space: nowrap; text-decoration: none; color: var(--ink-2);
    font-weight: 600; font-size: .88rem; padding: .5rem .95rem;
    border-radius: .65rem; transition: all .15s; flex-shrink: 0;
}
.pill-tabs a.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow); }

/* ─── النماذج ─── */
.form-control, .form-select {
    border-radius: .7rem; border-color: var(--line);
    padding: .6rem .85rem; min-height: 46px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(89, 155, 159, .15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 600; font-size: .88rem; color: var(--ink-2); margin-bottom: .3rem; }
label.requiredField .asteriskField { color: var(--bad); margin-inline-start: 2px; }

/* ─── شارات ─── */
.badge-soft-ok { background: var(--ok-soft); color: var(--ok); }
.badge-soft-warn { background: var(--warn-soft); color: var(--warn); }
.badge-soft-bad { background: var(--bad-soft); color: var(--bad); }
.badge-soft-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-soft-muted { background: #e8f0f0; color: var(--ink-2); }
.badge { font-weight: 700; border-radius: .5rem; padding: .35em .65em; }

/* ─── عناوين الصفحات ─── */
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 800; margin: 0; }
.page-head .ms-auto-actions { margin-inline-start: auto; display: flex; gap: .5rem; }

/* ─── أرقام مالية ─── */
.money { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.money-in { color: var(--ok); }
.money-out { color: var(--bad); }

/* ─── حالة فارغة ─── */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--ink-3); }
.empty-state i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .5; }

/* ─── شريط تقدم ─── */
.progress { height: 8px; border-radius: 99px; background: #e8f0f0; }
.progress-bar { background: var(--brand); border-radius: 99px; }

/* ─── بطاقات قوائم قابلة للنقر ─── */
a.row-card { display: block; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.row-card:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(46, 58, 59, .1); }

/* ─── طباعة الفاتورة ─── */
@media print {
    .topbar, .bottom-nav, .no-print, .alert { display: none !important; }
    body { background: #fff; padding: 0; }
    .app-main { padding: 0 !important; max-width: 100%; }
    .soft-card { box-shadow: none; border: none; }
}

/* ─── Alpine ─── */
[x-cloak] { display: none !important; }

/* ─── مؤشرات تقدم متعددة الألوان ─── */
.progress-bar.bar-ok { background: var(--ok); }
.progress-bar.bar-warn { background: var(--warn); }
.progress-bar.bar-bad { background: var(--bad); }

/* ─── مخططات ─── */
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 200px; }

/* ─── عناصر مساعدة ─── */
.tile {
    background: var(--brand-softer); border: 1px solid var(--brand-soft);
    border-radius: .8rem; padding: .6rem .8rem;
}
.tile .tile-label { font-size: .72rem; color: var(--ink-2); }
.hbar { height: 6px; border-radius: 99px; background: #e8f0f0; overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.sticky-filters { position: sticky; top: 60px; z-index: 5; }
.item-card { cursor: pointer; }
.item-card:hover { box-shadow: 0 4px 18px rgba(46, 58, 59, .1); }
.kind-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-inline-end: .35rem; }
.dot-in { background: var(--ok); } .dot-out { background: var(--bad); } .dot-transfer { background: var(--warn); }
@media (max-width: 575px) { .stat-card .stat-value { font-size: 1.1rem; } }

/* ─── كشف الحساب (البنود) ─── */
.sheet { font-variant-numeric: tabular-nums; font-size: .9rem; }
.sheet th.num, .sheet td.num { text-align: end; white-space: nowrap; }
.sheet td, .sheet th { padding: .45rem .75rem; }
.sheet .sheet-name { min-width: 220px; }
.sheet tr.sh-section td { background: var(--brand-softer); font-weight: 800; border-top: 1px solid var(--brand-soft); }
.sheet tr.sh-cat td { font-weight: 600; }
.sheet tr.sh-entry td { font-size: .8rem; color: var(--ink-2); background: #fbfdfd; border-bottom: 1px dashed var(--line); }
.sheet tr.sh-entry td.num { font-weight: 500; }
.sheet td.pct { color: var(--ink-3); font-size: .8rem; }
.sheet tbody.sheet-totals tr.sh-subtotal td { border-top: 2px solid var(--ink-3); font-weight: 800; }
.sheet tbody.sheet-totals tr.sh-total td { border-top: 1px solid var(--ink-3); border-bottom: 3px double var(--ink-3); font-weight: 800; background: var(--brand-softer); }
.sheet tbody.sheet-totals tr.sh-grand td { font-weight: 800; font-size: 1.02rem; background: var(--brand-soft); color: var(--brand-dark); }
.sheet tbody.sheet-totals tr.sh-note td { color: var(--warn); font-style: italic; }
@media (max-width: 575px) { .sheet .sheet-name { min-width: 160px; } .sheet { font-size: .82rem; } }
.sheet-wrap { max-width: 1000px; }

/* ─── نافذة منبثقة بسيطة (Alpine) ─── */
.cat-modal-backdrop {
    position: fixed; inset: 0; z-index: 1050; background: rgba(46, 58, 59, .45);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.cat-modal { width: 100%; max-width: 440px; box-shadow: 0 12px 40px rgba(46, 58, 59, .25); }

/* ─── الشريط السفلي: زر إضافة مركزي + صفائح الإجراءات ─── */
.bottom-nav { align-items: center; }
.bottom-nav .nav-fab {
    width: 54px; height: 54px; border-radius: 50%; border: 0; flex: 0 0 auto;
    background: linear-gradient(135deg, #6cadb1, var(--brand-dark)); color: #fff;
    font-size: 1.5rem; margin-top: -26px; box-shadow: 0 6px 16px rgba(89, 155, 159, .45);
}
.sheet-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(46, 58, 59, .4); }
.action-sheet {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 1045; background: #fff;
    border-radius: 1.25rem 1.25rem 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 30px rgba(46, 58, 59, .18);
}
.action-sheet .sheet-title { font-weight: 800; margin-bottom: .75rem; text-align: center; color: var(--ink-2); font-size: .9rem; }
.action-sheet .sheet-main {
    display: flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none;
    background: var(--brand); color: #fff; font-weight: 800; border-radius: .9rem; padding: .9rem; margin-bottom: .75rem;
}
.action-sheet .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.action-sheet .sheet-grid a {
    display: flex; flex-direction: column; align-items: center; gap: .3rem; text-decoration: none;
    color: var(--ink); background: var(--brand-softer); border: 1px solid var(--brand-soft);
    border-radius: .9rem; padding: .8rem .3rem; font-size: .8rem; font-weight: 600;
}
.action-sheet .sheet-grid a i { font-size: 1.3rem; color: var(--brand-dark); }
.action-sheet .sheet-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── مكونات لوحة العمل اليومي ─── */
.min-w-0 { min-width: 0; }
.kpi {
    display: block; height: 100%; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem .9rem;
    text-decoration: none; color: inherit;
}
.kpi-link:hover { border-color: var(--brand-soft); color: inherit; }
.kpi-label { font-size: .76rem; color: var(--ink-2); font-weight: 600; }
.kpi-label i { color: var(--brand); }
.kpi-value { font-size: 1.35rem; font-weight: 800; margin: .15rem 0; letter-spacing: -.02em; }
.kpi-sub { font-size: .7rem; color: var(--ink-3); }
.kpi-main { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border: 0; color: #fff; }
.kpi-main .kpi-label, .kpi-main .kpi-label i, .kpi-main .kpi-sub { color: rgba(255, 255, 255, .85); }
.kpi-main.is-bad { background: linear-gradient(135deg, #c25a4e, var(--bad)); }
@media (max-width: 575px) { .kpi-value { font-size: 1.15rem; } }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.qa {
    display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .75rem .25rem;
    background: var(--card); border: 1px solid var(--line); border-radius: .9rem; box-shadow: var(--shadow);
    text-decoration: none; color: var(--ink); font-weight: 700; font-size: .82rem;
}
.qa i { font-size: 1.3rem; color: var(--brand-dark); }
.qa:hover { border-color: var(--brand-soft); color: var(--ink); }
.qa-main { background: var(--brand); border-color: var(--brand); color: #fff; }
.qa-main i { color: #fff; }
.qa-main:hover { color: #fff; background: var(--brand-dark); }

.section-head { display: flex; align-items: center; gap: .4rem; font-weight: 800; font-size: .92rem; padding: .85rem 1rem .5rem; }
.section-head i { color: var(--ink-3); }
.section-title { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: .95rem; margin: .25rem 0 .5rem; }
.section-title i { color: var(--ink-3); }

.attn-row { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; border-top: 1px solid var(--line); font-size: .88rem; }
.attn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ink-3); }
.attn-warn .attn-dot { background: var(--warn); }
.attn-bad .attn-dot { background: var(--bad); }
.attn-bad .money { color: var(--bad); }
.attn-warn .money { color: var(--warn); }

.feed-row { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; border-top: 1px solid var(--line); font-size: .86rem; }
.project-card:hover { box-shadow: 0 4px 18px rgba(46, 58, 59, .1); }

/* ─── صفحة المشروع ─── */
.quick-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.hero-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.hero-value small { font-size: .9rem; color: var(--ink-3); font-weight: 600; }
.status-pill {
    display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 99px;
    font-size: .82rem; font-weight: 700; text-decoration: none; border: 1px solid transparent;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: #ecd9b0; }
.pill-warn:hover { color: var(--warn); filter: brightness(.97); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-muted { background: #eef3f3; color: var(--ink-2); }
.sticky-tabs { position: sticky; top: 60px; z-index: 20; box-shadow: 0 2px 8px rgba(46, 58, 59, .06); }

/* ─── السجل اليومي للمصاريف ─── */
.day-head { display: flex; align-items: center; gap: .5rem; padding: .65rem 1rem; background: #f1f6f6; border-radius: var(--radius) var(--radius) 0 0; font-size: .88rem; }
.exp-row { display: flex; align-items: center; gap: .6rem; padding: .6rem .5rem .6rem 1rem; border-top: 1px solid var(--line); }
.exp-row:hover { background: var(--brand-softer); }
.exp-row .money { font-size: .95rem; }

/* لون التحذير الافتراضي في Bootstrap فاتح جداً على الأبيض */
.text-warning { color: var(--warn) !important; }
.group-head { display: flex; justify-content: space-between; padding: 1rem 1rem .5rem; font-weight: 700; }

/* إجراءات المشروع: أزرار عريضة على الجوال، مدمجة على الشاشات الكبيرة */
@media (min-width: 992px) {
    .quick-grid.cols-3 { display: flex; gap: .5rem; }
    .quick-grid.cols-3 .qa { flex-direction: row; gap: .5rem; padding: .55rem 1.1rem; font-size: .9rem; }
    .quick-grid.cols-3 .qa i { font-size: 1.05rem; }
}

/* ─── ملخص حساب المشروع: معادلة واضحة بعناوين صريحة ─── */
.acct-card { padding: .25rem 0 0; overflow: hidden; }
.acct-title {
    font-size: .74rem; font-weight: 800; color: var(--ink-3); letter-spacing: .02em;
    padding: .75rem 1rem .35rem;
}
.acct { display: flex; flex-direction: column; }
.acct-cell {
    position: relative; display: grid; grid-template-columns: 1fr auto;
    grid-template-areas: "label value" "sub value"; align-items: center; column-gap: .75rem;
    padding: .6rem 1rem; border-top: 1px solid var(--line);
}
.acct-label { grid-area: label; font-size: .86rem; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: .4rem; }
.acct-value { grid-area: value; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-value small { font-size: .7rem; font-weight: 600; color: var(--ink-3); }
.acct-sub { grid-area: sub; font-size: .74rem; color: var(--ink-3); }
.acct-action { color: var(--warn); font-weight: 700; text-decoration: none; }
.acct-action:hover { color: var(--warn); text-decoration: underline; }
/* علامة العملية (+ = −) قبل العنوان */
.acct-cell[data-op] .acct-label::before {
    content: attr(data-op); display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%; background: #e8f0f0; color: var(--ink-2);
    font-size: .8rem; font-weight: 800; flex-shrink: 0;
}
.acct-cell[data-op="+"] .acct-label::before { content: "+"; }
.acct-cell[data-op="="] .acct-label::before { content: "="; }
.acct-cell[data-op="−"] .acct-label::before { content: "−"; }
.acct-result { background: var(--brand-softer); }
.acct-result.is-warn { background: var(--warn-soft); }
.acct-result.is-warn .acct-value { color: var(--warn); }
.acct-result.is-ok { background: var(--ok-soft); }
.acct-result.is-ok .acct-value { color: var(--ok); }
.acct-cash .acct-cell.is-bad { background: var(--bad-soft); }

/* الشاشات الكبيرة: صف واحد أفقي، والعلامة دائرة على الحد بين الخانات */
@media (min-width: 992px) {
    .acct { flex-direction: row; border-top: 1px solid var(--line); }
    .acct-cell {
        flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
        gap: .15rem; padding: .85rem 1.1rem; border-top: 0;
    }
    .acct-cell + .acct-cell { border-inline-start: 1px solid var(--line); }
    .acct-value { font-size: 1.35rem; }
    .acct-cell[data-op] .acct-label::before {
        position: absolute; inset-inline-start: -11px; top: 50%; transform: translateY(-50%);
        width: 22px; height: 22px; background: #fff; border: 1px solid var(--line); z-index: 1;
    }
    .acct-cash .acct-cell { flex: 0 0 50%; }
}

/* الأرقام السالبة: الإشارة تظهر يسار الرقم داخل النص العربي */
span.money { direction: ltr; unicode-bidi: isolate; }
div.money, td.money { unicode-bidi: plaintext; }
.acct-cash .acct-cell.is-bad { background: #fdf4f2; }

/* ─── الجداول على الجوال: كل صف يصبح عنصراً من سطرين ─── */
@media (max-width: 575.98px) {
    .table.m-list thead { display: none; }
    .table.m-list, .table.m-list > tbody, .table.m-list > tfoot { display: block; width: 100%; }
    .table.m-list tr {
        display: flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; row-gap: .15rem;
        padding: .6rem .9rem; border-top: 1px solid var(--line);
    }
    .table.m-list > tbody > tr:first-child { border-top: 0; }
    .table.m-list tr::after { content: ""; order: 4; flex-basis: 100%; height: 0; }
    .table.m-list td {
        display: block; padding: 0 !important; border: 0 !important;
        background: transparent !important; box-shadow: none !important;
    }
    .table.m-list td:empty, .table.m-list td.m-hide { display: none; }
    .table.m-list td.m-main { order: 1; flex: 1 1 0; min-width: 0; font-weight: 700; }
    .table.m-list td.m-amt { order: 2; flex: 0 0 auto; text-align: end; white-space: nowrap; }
    .table.m-list td.m-act { order: 3; flex: 0 0 auto; }
    .table.m-list td.m-sub { order: 5; flex: 0 1 auto; font-size: .76rem; color: var(--ink-3); max-width: 100%; }
    .table.m-list td.m-sub[data-label]::before { content: attr(data-label) " "; }
    .table.m-list td.m-sub .badge { font-size: .68rem; }
    .table.m-list > tfoot > tr { background: var(--brand-softer); font-weight: 800; }
    .table.m-list td[colspan]:not(.m-main):not(.m-amt):not(.text-center) { display: none; }
    .table.m-list td.text-center { flex-basis: 100%; }

    /* فلتر الفترة في المالية */
    .period-dates { width: 100%; }
    .period-dates input { flex: 1 1 0; min-width: 0; }
}

/* ─── تضييق المسافات على الجوال ─── */
@media (max-width: 575.98px) {
    .quick-grid.cols-3 .qa { flex-direction: row; justify-content: center; gap: .35rem; padding: .6rem .25rem; font-size: .8rem; }
    .quick-grid.cols-3 .qa i { font-size: 1rem; }
    .acct-title { padding: .55rem .9rem .2rem; }
    .acct-cell { padding: .45rem .9rem; }
    .acct-value { font-size: 1.02rem; }
    .acct-label { font-size: .82rem; }
    .acct-sub { font-size: .7rem; }
    .acct-cell[data-op] .acct-label::before { width: 18px; height: 18px; font-size: .72rem; }
    .page-head h1, h1.fs-4 { font-size: 1.2rem !important; }
}
@media (max-width: 575.98px) {
    .table.m-list td.m-main .small, .table.m-list td.m-main .text-secondary { font-weight: 400; }
}
@media (max-width: 359.98px) {
    .sheet .sheet-name { min-width: 0; }
    .sheet td, .sheet th { padding: .4rem .45rem; }
    .sheet { font-size: .78rem; }
    .kpi-value { font-size: 1rem; }
}

/* ─── من أضاف / عدّل ─── */
.audit-footer { margin-top: 1rem; padding-top: .75rem; border-top: 1px dashed var(--line); font-size: .78rem; color: var(--ink-3); line-height: 1.8; }
.audit-footer strong { color: var(--ink-2); }
.by { color: var(--ink-3); font-size: .74rem; white-space: nowrap; }
.by i { font-size: .7rem; }
.log-row { padding: .7rem 1rem; border-top: 1px solid var(--line); font-size: .88rem; }
.log-row:first-child { border-top: 0; }
.log-badge { font-size: .7rem; font-weight: 800; padding: .2rem .5rem; border-radius: .4rem; flex-shrink: 0; margin-top: .15rem; }
.log-create { background: var(--ok-soft); color: var(--ok); }
.log-update { background: var(--warn-soft); color: var(--warn); }
.log-delete { background: var(--bad-soft); color: var(--bad); }
.log-changes { margin: .5rem 0 0; padding: .5rem .75rem; background: #f6f9f9; border-radius: .6rem; font-size: .8rem; line-height: 1.9; overflow-wrap: anywhere; }

/* ─── قائمة الأصناف القابلة للبحث ─── */
.combo-native { display: none !important; }
.combo { position: relative; }
.combo-toggle { text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.combo-panel {
    position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 1060;
    background: #fff; border: 1px solid var(--line); border-radius: .8rem;
    box-shadow: 0 10px 30px rgba(46, 58, 59, .16); overflow: hidden;
}
.combo-search { position: relative; padding: .5rem; border-bottom: 1px solid var(--line); }
.combo-search i { position: absolute; inset-inline-start: 1.15rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.combo-search input { padding-inline-start: 2.1rem; min-height: 42px; font-size: 16px; }  /* 16px يمنع تكبير iOS */
.combo-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.combo-group { font-size: .72rem; font-weight: 800; color: var(--ink-3); padding: .5rem .9rem .2rem; background: #f8fbfb; position: sticky; top: 0; }
.combo-group.is-other { color: var(--warn); }
.combo-opt { padding: .55rem .9rem; cursor: pointer; display: flex; align-items: center; gap: .35rem; font-size: .92rem; }
.combo-opt.is-active { background: var(--brand-softer); }
.combo-opt.is-selected { font-weight: 800; color: var(--brand-dark); }
.combo-opt.is-selected::after { content: "✓"; margin-inline-start: auto; }
.combo-clear { color: var(--ink-3); border-bottom: 1px solid var(--line); }
.combo-type { margin-inline-start: auto; font-size: .68rem; font-weight: 700; background: var(--warn-soft); color: var(--warn); padding: .1rem .45rem; border-radius: .4rem; }
.combo-empty { padding: .9rem; text-align: center; color: var(--ink-3); font-size: .85rem; }
.combo-new {
    display: flex; align-items: center; gap: .4rem; width: 100%; border: 0; border-top: 1px solid var(--line);
    background: var(--brand-softer); color: var(--brand-dark); font-weight: 700; padding: .65rem .9rem; text-align: start;
}
@media (max-width: 575.98px) { .combo-list { max-height: 45vh; } }
#div_id_category { margin-bottom: .35rem !important; }

/* ─── دفعات الزبون: مفتاح الاتجاه (+ دفعة / − سحب) ─── */
.kind-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; background: #e8f0f0; border-radius: .85rem; }
.kind-opt {
    display: flex; align-items: center; justify-content: center; gap: .45rem; margin: 0;
    padding: .65rem .5rem; border-radius: .65rem; cursor: pointer; font-weight: 700; font-size: .9rem;
    color: var(--ink-2); transition: background .15s, color .15s, box-shadow .15s; text-align: center;
}
.kind-opt input { position: absolute; opacity: 0; pointer-events: none; }
.kind-sign {
    width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; background: #fff; color: var(--ink-3); flex-shrink: 0;
}
.kind-opt:has(input:checked) { background: #fff; box-shadow: var(--shadow); }
.kind-in:has(input:checked) { color: var(--ok); }
.kind-in:has(input:checked) .kind-sign { background: var(--ok); color: #fff; }
.kind-out:has(input:checked) { color: var(--bad); }
.kind-out:has(input:checked) .kind-sign { background: var(--bad); color: #fff; }
.kind-opt:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
/* لون القيمة يتبع الاتجاه */
form:has(.kind-in input:checked) #id_amount { color: var(--ok); font-weight: 800; }
form:has(.kind-out input:checked) #id_amount { color: var(--bad); font-weight: 800; }

.pay-sign { font-weight: 800; }
.pay-row-out td { background: #fdf6f5; }
.btn-withdraw { color: var(--bad); border-color: var(--bad-soft); background: #fdf4f2; }
.btn-withdraw:hover { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-soft); }
@media (max-width: 575.98px) { .table.m-list tr.pay-row-out { background: #fdf6f5; } }

