/* ============================================================
   نظام الموردين — Mobile App Design
   Cairo Font | Pastel Colors | Flat Design | RTL
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

/* ─── Design Tokens ─── */
:root {
    --primary:       #7C6FF7;
    --primary-light: #EEE8FF;
    --primary-dark:  #5A4FDA;
    --primary-pale:  #F5F3FF;

    --success:       #3DC9BF;
    --success-light: #E0FAF8;
    --success-dark:  #2BA8A0;

    --danger:        #FF6B8A;
    --danger-light:  #FFE8ED;
    --danger-dark:   #D94F6E;

    --warning:       #FFB347;
    --warning-light: #FFF3DC;

    --accent:        #FF8C5A;
    --accent-light:  #FFEDE4;

    --info:          #60B8FF;
    --info-light:    #E3F3FF;

    --bg:            #FFFFFF;
    --card-bg:       #FFFFFF;
    --input-bg:      #F8F8F8;

    --text:          #1A1A2E;
    --text-muted:    #7A7A95;
    --text-light:    #BDBDCE;

    --border:        #EBEBF0;
    --divider:       #F2F2F5;

    --top-bar-h:     60px;
    --bottom-nav-h:  68px;
    --radius:        14px;
    --radius-lg:     18px;
    --radius-xl:     22px;
    --radius-full:   100px;
    --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

/* ─── Dark Mode ─── */
body.var-dark,
html.var-dark body {
    --primary:       #9585F9;
    --primary-light: #1E1E28;
    --primary-dark:  #7C6FF7;
    --primary-pale:  #161620;

    --success:       #5DD4CB;
    --success-light: #0B1F1E;

    --danger:        #FF8099;
    --danger-light:  #1F0A10;

    --warning:       #FFC467;
    --warning-light: #1F1500;

    --accent:        #FF9D73;
    --accent-light:  #1F0E00;

    --info:          #80C8FF;
    --info-light:    #081522;

    --bg:            #000000;
    --card-bg:       #111111;
    --input-bg:      #0A0A0A;

    --text:          #F0F0F0;
    --text-muted:    #888888;
    --text-light:    #444444;

    --border:        #222222;
    --divider:       #1A1A1A;
}

/* ─── Reset ─── */
*, *::before, *::after {
    box-sizing: border-box; margin: 0; padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 15px; scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button, input, select, textarea { font-family: 'Cairo', sans-serif; }

/* ─── App Container ─── */
.app-container {
    max-width: 480px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
    transition: background 0.3s;
}

@media (min-width: 769px) {
    body {
        background: #F4F4F6;
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }
    body.var-dark,
    html.var-dark body { background: #000 !important; }
    .app-container {
        border-left: 1px solid rgba(0,0,0,0.08);
        border-right: 1px solid rgba(0,0,0,0.08);
    }
    body.var-dark .app-container,
    html.var-dark .app-container {
        border-left: 1px solid rgba(255,255,255,0.06);
        border-right: 1px solid rgba(255,255,255,0.06);
    }
}

/* ─── Top App Bar ─── */
.app-bar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--top-bar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
    transition: background 0.3s, border-color 0.3s;
}

.app-bar-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-bar-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    background: var(--primary-light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: opacity 0.2s, transform 0.1s;
    flex-shrink: 0;
    text-decoration: none;
}

.app-bar-btn:hover   { opacity: 0.8; }
.app-bar-btn:active  { transform: scale(0.9); }
.app-bar-btn svg { width: 18px; height: 18px; stroke-width: 2.5; }
.app-bar-btn.muted { background: var(--border); color: var(--text-muted); }

/* ─── Page Content ─── */
.page-content {
    padding: calc(var(--top-bar-h) + 1.1rem) 1rem calc(var(--bottom-nav-h) + 1.1rem + var(--safe-bottom));
}

/* ─── Bottom Navigation ─── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
    transition: background 0.3s;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.55rem 0;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
    border: none;
    background: none;
    text-decoration: none;
    position: relative;
}

.nav-tab.active { color: var(--primary); }

.nav-tab.active::after {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

.nav-icon-wrap {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    transition: background 0.2s;
}

.nav-tab.active .nav-icon-wrap { background: var(--primary-light); }
.nav-icon-wrap svg { width: 20px; height: 20px; stroke-width: 2; }
.nav-tab.active .nav-icon-wrap svg { stroke-width: 2.5; }

.nav-label { font-size: 0.68rem; font-weight: 700; }

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: background 0.3s, border-color 0.3s;
}

.card-last { margin-bottom: 0; }

.card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--divider);
}

.card-title { font-size: 0.9rem; font-weight: 800; color: var(--text); }
.card-body  { padding: 1.25rem; }
.card-body-sm { padding: 1rem; }

/* ─── Welcome / Hero Card ─── */
.welcome-card {
    background: var(--primary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -35px; right: -25px;
    width: 130px; height: 130px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

.welcome-card::after {
    content: '';
    position: absolute;
    bottom: -40px; left: -20px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.wc-inner { position: relative; z-index: 1; }
.wc-greeting { font-size: 0.8rem; opacity: 0.8; }
.wc-name { font-size: 1.15rem; font-weight: 900; margin-bottom: 1rem; }
.wc-debt-label { font-size: 0.75rem; opacity: 0.8; margin-bottom: 0.2rem; }
.wc-debt-amount { font-size: 1.75rem; font-weight: 900; }

/* ─── Balance Hero ─── */
.balance-hero {
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    border: 1.5px solid;
}

.balance-hero.debtor   { background: var(--danger-light);  border-color: rgba(255,107,138,0.3); }
.balance-hero.settled  { background: var(--primary-light); border-color: rgba(124,111,247,0.3); }
.balance-hero.creditor { background: var(--success-light); border-color: rgba(61,201,191,0.3); }

.bh-supplier-name { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: 0.5rem; }
.bh-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 0.4rem; }
.balance-hero.debtor   .bh-label { color: var(--danger); }
.balance-hero.settled  .bh-label { color: var(--primary); }
.balance-hero.creditor .bh-label { color: var(--success); }

.bh-amount { font-size: 2rem; font-weight: 900; line-height: 1; margin-bottom: 0.3rem; }
.balance-hero.debtor   .bh-amount { color: var(--danger); }
.balance-hero.settled  .bh-amount { color: var(--primary); }
.balance-hero.creditor .bh-amount { color: var(--success); }

.bh-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 700;
}

.balance-hero.debtor  .bh-badge { background: rgba(255,107,138,0.15); color: var(--danger); }
.balance-hero.settled .bh-badge { background: rgba(124,111,247,0.15); color: var(--primary); }
.balance-hero.creditor .bh-badge { background: rgba(61,201,191,0.15); color: var(--success); }

/* ─── Stats Grid ─── */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stats-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

.stat-pill {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex; flex-direction: column; gap: 0.2rem;
    transition: background 0.3s;
}

.sp-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.5rem;
}

.sp-icon svg { width: 17px; height: 17px; stroke-width: 2; }
.sp-icon.purple  { background: var(--primary-light); color: var(--primary); }
.sp-icon.teal    { background: var(--success-light); color: var(--success); }
.sp-icon.pink    { background: var(--danger-light);  color: var(--danger); }
.sp-icon.amber   { background: var(--warning-light); color: var(--warning); }
.sp-icon.orange  { background: var(--accent-light);  color: var(--accent); }
.sp-icon.blue    { background: var(--info-light);    color: var(--info); }

.sp-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.sp-value { font-size: 1.1rem; font-weight: 900; color: var(--text); }
.sp-value.pink   { color: var(--danger); }
.sp-value.teal   { color: var(--success); }
.sp-value.purple { color: var(--primary); }
.sp-value.amber  { color: var(--warning); }

/* ─── Section Header ─── */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.65rem;
}

.section-title { font-size: 0.9rem; font-weight: 800; color: var(--text); }

.section-link {
    font-size: 0.78rem; font-weight: 700;
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    transition: background 0.2s; cursor: pointer;
}
.section-link:hover { background: var(--primary-light); }

/* ─── Transaction Feed ─── */
.tx-feed { display: flex; flex-direction: column; }

.tx-item {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.9rem 1.25rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--divider);
    transition: background 0.15s;
}

.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: var(--primary-pale); }

.tx-icon {
    width: 42px; height: 42px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.tx-icon svg { width: 19px; height: 19px; stroke-width: 2; }
.tx-icon.purchase { background: var(--danger-light); color: var(--danger); }
.tx-icon.payment  { background: var(--success-light); color: var(--success); }

.tx-meta { flex: 1; min-width: 0; }
.tx-type { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.tx-date-note { font-size: 0.73rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex-shrink: 0; }

.tx-amount { font-size: 0.88rem; font-weight: 800; white-space: nowrap; }
.tx-amount.purchase { color: var(--danger); }
.tx-amount.payment  { color: var(--success); }

.tx-actions { display: flex; gap: 0.35rem; }

/* ─── Supplier List Items ─── */
.supplier-list { display: flex; flex-direction: column; }

.supplier-item {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.9rem 1.25rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--divider);
    cursor: pointer; transition: background 0.15s;
    text-decoration: none;
}

.supplier-item:last-child { border-bottom: none; }
.supplier-item:hover { background: var(--primary-pale); }

.si-avatar {
    width: 44px; height: 44px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 1.05rem;
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
}

.si-info { flex: 1; min-width: 0; }
.si-name  { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.si-phone { font-size: 0.73rem; color: var(--text-muted); }

.si-balance { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex-shrink: 0; }

.si-amount { font-size: 0.88rem; font-weight: 800; }
.si-amount.debtor   { color: var(--danger); }
.si-amount.settled  { color: var(--text-muted); }
.si-amount.creditor { color: var(--success); }

.si-badge {
    font-size: 0.68rem; font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
}
.si-badge.debtor   { background: var(--danger-light);  color: var(--danger); }
.si-badge.settled  { background: var(--border);        color: var(--text-muted); }
.si-badge.creditor { background: var(--success-light); color: var(--success); }

.si-chevron { color: var(--text-light); flex-shrink: 0; }
.si-chevron svg { width: 15px; height: 15px; stroke-width: 2.5; }

/* ─── Settings Groups ─── */
.settings-group {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: background 0.3s;
}

.settings-item {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--divider);
    cursor: pointer; transition: background 0.15s;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--primary-pale); }
.settings-item.no-hover { cursor: default; }
.settings-item.no-hover:hover { background: none; }

.set-icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.set-icon svg { width: 17px; height: 17px; stroke-width: 2; }
.set-icon.purple { background: var(--primary-light); color: var(--primary); }
.set-icon.pink   { background: var(--danger-light);  color: var(--danger); }
.set-icon.teal   { background: var(--success-light); color: var(--success); }
.set-icon.amber  { background: var(--warning-light); color: var(--warning); }
.set-icon.blue   { background: var(--info-light);    color: var(--info); }
.set-icon.orange { background: var(--accent-light);  color: var(--accent); }

.set-info { flex: 1; }
.set-label { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.set-desc  { font-size: 0.73rem; color: var(--text-muted); }

.set-arrow { color: var(--text-light); }
.set-arrow svg { width: 15px; height: 15px; stroke-width: 2.5; }

/* ─── Profile Card ─── */
.profile-card {
    background: var(--primary);
    border-radius: var(--radius-xl);
    padding: 1.75rem 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: -30px; right: -25px;
    width: 110px; height: 110px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.pa-avatar {
    width: 68px; height: 68px;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.7rem; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.75rem;
    position: relative; z-index: 1;
}

.pa-name { font-size: 1.1rem; font-weight: 800; position: relative; z-index: 1; }
.pa-role { font-size: 0.78rem; opacity: 0.8; position: relative; z-index: 1; }

/* ─── Toggle Switch ─── */
.toggle-wrap { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    position: absolute; inset: 0;
    border-radius: 12px;
    background: var(--border);
    cursor: pointer;
    transition: background 0.25s;
}
.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px; right: 2px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.25s;
}
.toggle-wrap input:checked + .toggle-track { background: var(--primary); }
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(-20px); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border: none; border-radius: var(--radius);
    font-family: 'Cairo', sans-serif;
    font-size: 0.88rem; font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap; line-height: 1;
}

.btn:active { transform: scale(0.96); }
.btn:hover  { opacity: 0.87; }
.btn svg { width: 16px; height: 16px; stroke-width: 2.5; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-accent  { background: var(--accent);  color: #fff; }

.btn-ghost         { background: var(--primary-light); color: var(--primary); }
.btn-ghost-danger  { background: var(--danger-light);  color: var(--danger); }
.btn-ghost-success { background: var(--success-light); color: var(--success); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}

.btn-sm  { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-xs  { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.btn-full { width: 100%; }

/* ─── Icon Button ─── */
.btn-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.2s, transform 0.1s;
    background: var(--primary-light);
    color: var(--primary);
}

.btn-icon:active { transform: scale(0.9); }
.btn-icon svg { width: 15px; height: 15px; stroke-width: 2.5; }
.btn-icon.danger { background: var(--danger-light); color: var(--danger); }

/* ─── FAB ─── */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 1rem + var(--safe-bottom));
    left: 1.25rem;
    width: 52px; height: 52px;
    border-radius: var(--radius-xl);
    background: var(--primary);
    color: #fff; border: none;
    font-size: 1.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 90;
    transition: transform 0.2s, opacity 0.2s;
}
.fab:hover  { transform: scale(1.05); }
.fab:active { transform: scale(0.92); }
.fab svg { width: 24px; height: 24px; stroke-width: 2.5; }

/* ─── Forms ─── */
.form-group { margin-bottom: 0.9rem; }

.form-label {
    display: block;
    font-size: 0.8rem; font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase; letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem; color: var(--text);
    background: var(--input-bg);
    outline: none;
    transition: border-color 0.2s, background 0.3s;
    -webkit-appearance: none; appearance: none;
}

.form-control:focus { border-color: var(--primary); background: var(--card-bg); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ─── Bottom Sheet Modal ─── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,14,26,0.55);
    z-index: 1000;
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%; max-width: 480px;
    max-height: 92vh; overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1), background 0.3s;
    padding-bottom: calc(0.5rem + var(--safe-bottom));
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-handle {
    width: 34px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0.75rem auto 1rem;
}

.modal-header {
    padding: 0 1.25rem 0.75rem;
    display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 0.95rem; font-weight: 800; color: var(--text); }

.modal-close {
    width: 30px; height: 30px;
    border: none; border-radius: 9px;
    background: var(--border);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-close svg { width: 15px; height: 15px; stroke-width: 2.5; }

.modal-body   { padding: 0 1.25rem 1.25rem; }
.modal-footer { padding: 0.75rem 1.25rem 0; display: flex; gap: 0.75rem; }

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    top: calc(var(--top-bar-h) + 0.6rem);
    left: 50%; transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; gap: 0.5rem;
    pointer-events: none;
    width: calc(100% - 2rem); max-width: 440px;
}

.toast {
    border-radius: var(--radius);
    padding: 0.8rem 1.1rem;
    font-size: 0.85rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.6rem;
    animation: slideDown 0.3s ease;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.success { background: var(--success-light); color: var(--success); }
.toast.error   { background: var(--danger-light);  color: var(--danger); }
.toast.info    { background: var(--primary-light); color: var(--primary); }

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

/* ─── Search Bar ─── */
.search-wrap {
    position: relative; margin-bottom: 1rem;
}
.search-wrap .form-control {
    padding-right: 2.7rem;
    border-radius: var(--radius-full);
}
.search-wrap .search-ic {
    position: absolute;
    right: 1rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.search-wrap .search-ic svg { width: 16px; height: 16px; }

/* ─── Chips / Filters ─── */
.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }

.chip {
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem; font-weight: 700;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--card-bg); color: var(--text-muted);
    transition: all 0.2s;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Filter Card ─── */
.filter-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: background 0.3s;
}

/* ─── File Upload ─── */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center; cursor: pointer;
    transition: border-color 0.2s;
    font-size: 0.82rem; color: var(--text-muted);
    background: var(--input-bg);
}
.file-upload-area:hover { border-color: var(--primary); color: var(--primary); }
.file-upload-area input { display: none; }

/* ─── Lightbox ─── */
.lightbox-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.lightbox-overlay.open { opacity: 1; pointer-events: all; }
.lightbox-overlay img { max-width: 90vw; max-height: 85vh; border-radius: var(--radius); }
.lightbox-close {
    position: absolute; top: 1rem; left: 1rem;
    background: rgba(255,255,255,0.12);
    border: none; color: #fff; width: 42px; height: 42px;
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.lightbox-close svg { width: 20px; height: 20px; }

/* ─── Badges ─── */
.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.73rem; font-weight: 700;
}
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-muted   { background: var(--border);        color: var(--text-muted); }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
thead th {
    background: var(--primary-light); color: var(--primary);
    font-weight: 700; padding: 0.7rem 1rem;
    text-align: right; white-space: nowrap; font-size: 0.75rem;
}
tbody tr { border-bottom: 1px solid var(--divider); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-pale); }
td { padding: 0.8rem 1rem; vertical-align: middle; }
tfoot td { font-weight: 800; background: var(--primary-light); color: var(--primary); padding: 0.8rem 1rem; }

/* ─── Alerts ─── */
.alert {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.5rem;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; }
.alert-danger  { background: var(--danger-light);  color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); }

/* ─── Empty State ─── */
.empty-state { text-align: center; padding: 3rem 1.5rem; }

.empty-icon {
    width: 68px; height: 68px;
    border-radius: 20px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
}
.empty-icon svg { width: 30px; height: 30px; stroke-width: 1.5; }
.empty-state h3 { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 0.4rem; }
.empty-state p  { font-size: 0.82rem; color: var(--text-muted); }

/* ─── PW toggle ─── */
.input-pw-wrap { position: relative; }
.pw-toggle {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text-muted);
    display: flex; align-items: center;
}
.pw-toggle svg { width: 17px; height: 17px; }

/* ─── Page Header ─── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; gap: 0.75rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.page-header p  { font-size: 0.78rem; color: var(--text-muted); }

/* ─── Responsive ─── */
@media (max-width: 400px) {
    :root { font-size: 14px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-row.cols-3 { grid-template-columns: 1fr 1fr; }
}

/* ─── Arabic Date Picker ─── */
.dp-overlay {
    position: fixed; inset: 0;
    background: rgba(15,14,26,0.55);
    z-index: 9100;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
}
.dp-overlay.open { opacity: 1; pointer-events: all; }

.dp-card {
    background: var(--card-bg);
    border-radius: 22px;
    padding: 1.25rem;
    width: min(340px, 92vw);
    border: 1px solid var(--border);
}

.dp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.9rem;
}
.dp-month-label { font-size: 1rem; font-weight: 900; color: var(--text); }

.dp-nav {
    width: 34px; height: 34px;
    border-radius: 50%; border: none;
    background: var(--primary-light); color: var(--primary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.dp-nav:hover { background: var(--primary); color: #fff; }
.dp-nav svg   { width: 16px; height: 16px; stroke-width: 2.5; }

.dp-weekdays {
    display: grid; grid-template-columns: repeat(7,1fr);
    margin-bottom: .35rem;
}
.dp-wd {
    text-align: center; font-size: .68rem; font-weight: 800;
    color: var(--text-muted); padding: .25rem 0;
}

.dp-grid {
    display: grid; grid-template-columns: repeat(7,1fr); gap: .15rem;
}
.dp-cell {
    aspect-ratio: 1; border-radius: 50%; border: none;
    background: transparent; color: var(--text);
    font-size: .82rem; font-weight: 600; font-family: 'Cairo', sans-serif;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .13s, color .13s;
}
.dp-cell:hover                   { background: var(--primary-light); color: var(--primary); }
.dp-cell.dp-today                { border: 2px solid var(--primary); color: var(--primary); }
.dp-cell.dp-selected             { background: var(--primary) !important; color: #fff !important; border: none; }
.dp-cell.dp-other                { color: var(--text-light); }
.dp-cell.dp-other:hover          { opacity: .6; }

.dp-footer {
    display: flex; gap: .6rem; margin-top: .9rem;
    border-top: 1px solid var(--divider); padding-top: .75rem;
}

/* Date display button (replaces native input) */
.dp-display-btn {
    width: 100%;
    padding: .7rem 1rem;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    background: var(--input-bg); color: var(--text);
    font-family: 'Cairo', sans-serif; font-size: .9rem; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    transition: border-color .2s;
    text-align: right;
}
.dp-display-btn:focus,
.dp-display-btn:hover { border-color: var(--primary); outline: none; }
.dp-display-btn .dp-placeholder { color: var(--text-light); }
.dp-display-btn svg { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }

/* ─── Nav Centre FAB ─── */
.nav-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: 3px solid var(--page-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 18px rgba(124,111,247,.45);
    transition: transform .18s, box-shadow .18s;
    flex-shrink: 0;
    position: relative;
}
.nav-fab:active  { transform: scale(.9); box-shadow: 0 2px 8px rgba(124,111,247,.3); }
.nav-fab:hover   { transform: scale(1.06); }
.nav-fab svg     { width: 22px; height: 22px; }

/* ─── Type Chip Selector (purchase / payment) ─── */
.type-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
    flex: 1;
    justify-content: center;
    user-select: none;
}
.type-chip input[type="radio"] { display: none; }
.type-chip.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* ─── Transaction Items Table ─── */
.items-col-header {
    display: grid;
    grid-template-columns: 1fr 58px 72px 60px 32px;
    gap: 0.3rem;
    padding: 0 0 0.4rem;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.items-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }

.item-row {
    display: grid;
    grid-template-columns: 1fr 58px 72px 60px 32px;
    gap: 0.3rem;
    align-items: center;
}

.item-row .form-control {
    padding: 0.42rem 0.55rem;
    font-size: 0.8rem;
    border-radius: 10px;
}

.item-subtotal {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    white-space: nowrap;
}

.items-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0 0;
    border-top: 1px solid var(--divider);
    margin-top: 0.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.items-total-row .total-amount {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--primary);
}

/* Items display in detail page */
.items-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.items-table th {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    padding: 0.6rem 0.75rem;
    text-align: right;
    font-size: 0.75rem;
    white-space: nowrap;
}

.items-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--divider);
    vertical-align: middle;
}

.items-table tr:last-child td { border-bottom: none; }
.items-table tfoot td {
    font-weight: 800;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.65rem 0.75rem;
}

/* Badge for item count in tx list */
.tx-items-count {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    margin-top: 0.15rem;
}

