/* ============================================================
   Sofazi v4.0 — Stylesheet
   ============================================================ */

/* ── Design Tokens ── */
:root {
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --surface2: #f7fafc;
  --border:   #e2e8f0;
  --text:     #1a202c;
  --text2:    #64748b;
  --text3:    #94a3b8;
  --primary:  #1e40af;
  --primary-light: #dbeafe;
  --accent:   #0ea5e9;
  --success:  #059669;
  --success-light: #d1fae5;
  --danger:   #dc2626;
  --danger-light: #fee2e2;
  --warning:  #d97706;
  --warning-light: #fef3c7;
  --purple:   #7c3aed;
  --purple-light: #ede9fe;
  --nav-bg:   #0f172a;
  --top-h:    60px;
  --nav-w:    260px;
  --radius:   16px;
  --shadow:   0 4px 24px rgba(0,0,0,.07);
  --shadow-lg:0 8px 40px rgba(0,0,0,.12);
}
body.dark {
  --bg:       #070d1a;
  --surface:  #101828;
  --surface2: #0d1525;
  --border:   #1a2540;
  --text:     #e2e8f0;
  --text2:    #94a3b8;
  --text3:    #475569;
  --primary-light: #1e3a8a;
  --success-light: #052e16;
  --danger-light:  #450a0a;
  --warning-light: #431407;
  --purple-light:  #2e1065;
  --shadow:   0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:0 8px 40px rgba(0,0,0,.6);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Tajawal', sans-serif; background: var(--bg); color: var(--text); transition: background .3s, color .3s; overflow-x: hidden; }

/* ── Splash ── */
#splash { position: fixed; inset: 0; background: #0f172a; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity .6s, visibility .6s; }
#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo { width: 100px; height: 100px; background: linear-gradient(135deg,#1e40af,#0ea5e9); border-radius: 28px; display: flex; align-items: center; justify-content: center; font-size: 3.2rem; margin-bottom: 20px; animation: splashPop .7s cubic-bezier(.34,1.56,.64,1) both; box-shadow: 0 0 80px rgba(30,64,175,.6); }
@keyframes splashPop { from { transform: scale(.3) rotate(-15deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.splash-name { font-size: 2.2rem; font-weight: 900; color: #fff; letter-spacing: .06em; animation: fadeUp .5s .3s both; }
.splash-ver  { font-size: .85rem; color: #3b82f6; margin-top: 4px; animation: fadeUp .5s .5s both; }
.splash-bar  { width: 140px; height: 3px; background: #1e293b; border-radius: 10px; margin-top: 44px; overflow: hidden; }
.splash-prog { height: 100%; background: linear-gradient(90deg,#1e40af,#0ea5e9,#38bdf8); animation: splashLoad 1.8s ease-out forwards; }
@keyframes splashLoad { from { width: 0 } to { width: 100% } }
@keyframes fadeUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Offline Banner ── */
#offlineBanner { position: fixed; top: var(--top-h); left: 0; right: 0; background: #d97706; color: #fff; text-align: center; padding: 8px; font-size: .8rem; font-weight: 600; z-index: 90; transform: translateY(-100%); transition: transform .3s; display: flex; align-items: center; justify-content: center; gap: 8px; }
#offlineBanner.show { transform: translateY(0); }

/* ── App Layout ── */
#app { display: grid; grid-template-rows: var(--top-h) 1fr; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }

/* ── Topbar ── */
#topbar { grid-column: 1 / -1; background: var(--nav-bg); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 20px rgba(0,0,0,.35); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-icon  { width: 38px; height: 38px; background: linear-gradient(135deg,#1e40af,#0ea5e9); border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 900; color: #fff; }
.brand-name  { font-weight: 900; font-size: 1.15rem; color: #fff; }
.brand-ver   { font-size: .6rem; color: #475569; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border: none; background: rgba(255,255,255,.07); border-radius: 10px; color: #94a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .95rem; transition: all .2s; }
.icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
#menuToggle { display: none; }

/* ── Sidebar ── */
#sidebar { background: var(--nav-bg); grid-row: 2; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #1e293b transparent; transition: right .3s cubic-bezier(.4,0,.2,1); }
.sidebar-user { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 12px; }
.user-av  { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; flex-shrink: 0; color: #fff; }
.user-nm  { font-weight: 700; font-size: .9rem; color: #e2e8f0; }
.user-rl  { font-size: .72rem; color: #475569; margin-top: 2px; }
.sidebar-sec { padding: 10px 0 0; }
.sidebar-lbl { padding: 8px 16px 3px; font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: #334155; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 16px; cursor: pointer; color: #64748b; font-size: .88rem; font-weight: 500; transition: all .2s; border-right: 3px solid transparent; margin: 1px 0; text-decoration: none; }
.nav-item i { width: 18px; text-align: center; font-size: .9rem; transition: transform .2s; }
.nav-item:hover  { color: #cbd5e1; background: rgba(255,255,255,.04); }
.nav-item.active { color: #fff; background: rgba(30,64,175,.25); border-right-color: #3b82f6; }
.nav-item.active i { transform: scale(1.1); color: #60a5fa; }
.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.06); margin-top: 6px; }
.btn-logout { width: 100%; padding: 10px; background: rgba(220,38,38,.1); border: 1px solid rgba(220,38,38,.2); border-radius: 10px; color: #f87171; cursor: pointer; font-family: inherit; font-size: .85rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s; }
.btn-logout:hover { background: rgba(220,38,38,.2); }

/* ── Main ── */
#main { grid-row: 2; overflow-y: auto; padding: 24px; min-height: calc(100vh - var(--top-h)); }

/* ── Cards ── */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 15px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: .92rem; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; border: none; box-shadow: var(--shadow); cursor: pointer; transition: transform .2s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-card::after { content: ''; position: absolute; bottom: -20px; right: -10px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.07); }
.stat-card.blue   { background: linear-gradient(135deg,#1e3a8a,#2563eb); color: #fff; }
.stat-card.green  { background: linear-gradient(135deg,#064e3b,#059669); color: #fff; }
.stat-card.red    { background: linear-gradient(135deg,#7f1d1d,#dc2626); color: #fff; }
.stat-card.amber  { background: linear-gradient(135deg,#78350f,#d97706); color: #fff; }
.stat-card.purple { background: linear-gradient(135deg,#4c1d95,#7c3aed); color: #fff; }
.stat-icon  { font-size: 1.4rem; opacity: .8; margin-bottom: 8px; }
.stat-val   { font-size: 1.35rem; font-weight: 900; line-height: 1; }
.stat-label { font-size: .72rem; opacity: .75; margin-top: 3px; font-weight: 500; }

/* ── Buttons ── */
.btn { padding: 9px 16px; border-radius: 10px; border: none; cursor: pointer; font-family: inherit; font-size: .84rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; transition: all .2s; text-decoration: none; white-space: nowrap; }
.btn i { font-size: .82rem; }
.btn-primary  { background: var(--primary);  color: #fff; box-shadow: 0 2px 8px rgba(30,64,175,.3); }
.btn-primary:hover  { background: #1d4ed8; transform: translateY(-1px); }
.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { background: #047857; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-warning:hover  { background: #b45309; }
.btn-info     { background: var(--accent);   color: #fff; }
.btn-info:hover     { background: #0284c7; }
.btn-secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-purple   { background: var(--purple);   color: #fff; }
.btn-purple:hover   { background: #6d28d9; }
.btn-sm  { padding: 6px 12px; font-size: .78rem; border-radius: 8px; }
.btn-xs  { padding: 4px 9px;  font-size: .72rem; border-radius: 7px; }

/* ── Forms ── */
.form-group { margin-bottom: 13px; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text2); margin-bottom: 5px; display: block; }
.form-control { width: 100%; padding: 10px 13px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; font-size: .88rem; transition: all .2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,64,175,.12); background: var(--surface); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 75px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead th { background: var(--surface2); padding: 11px 13px; font-weight: 700; color: var(--text2); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 13px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── Badges ── */
.badge { padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 700; display: inline-block; white-space: nowrap; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: #e0f2fe; color: #0284c7; }
.badge-purple  { background: var(--purple-light);  color: var(--purple);  }
body.dark .badge-info { background: #075985; color: #7dd3fc; }
.role-admin   { background: rgba(30,64,175,.15);  color: #3b82f6; padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 700; }
.role-manager { background: rgba(124,58,237,.15); color: #7c3aed; padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 700; }

/* ── Modals ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 500; backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .2s; }
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
.modal-box { background: var(--surface); border-radius: 20px; width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .28s cubic-bezier(.34,1.56,.64,1); }
.modal-box.modal-lg { max-width: 740px; }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.modal-header { padding: 18px 22px 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-title  { font-size: 1rem; font-weight: 800; }
.modal-body   { padding: 18px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close  { width: 32px; height: 32px; border: none; background: var(--surface2); border-radius: 8px; cursor: pointer; color: var(--text2); font-size: .95rem; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

/* ── Toast ── */
#toastContainer { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #0f172a; color: #e2e8f0; padding: 11px 18px; border-radius: 40px; display: flex; align-items: center; gap: 9px; font-size: .855rem; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.1); animation: toastIn .3s cubic-bezier(.34,1.56,.64,1); white-space: nowrap; }
@keyframes toastIn  { from { transform: translateY(16px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.toast.out { animation: toastOut .25s forwards; }
@keyframes toastOut { to { transform: translateY(14px); opacity: 0 } }
.toast-ic { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; flex-shrink: 0; }
.toast.success .toast-ic { background: rgba(5,150,105,.2); color: #34d399; }
.toast.error   .toast-ic { background: rgba(220,38,38,.2);  color: #f87171; }
.toast.info    .toast-ic { background: rgba(14,165,233,.2); color: #38bdf8; }

/* ── Loading ── */
#loadingOverlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 8000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.loader { width: 46px; height: 46px; border: 4px solid rgba(255,255,255,.15); border-top-color: #60a5fa; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-title  { font-size: 1.25rem; font-weight: 800; }
.page-title small { font-size: .77rem; color: var(--text3); font-weight: 400; display: block; margin-top: 1px; }

/* ── Search ── */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input { padding-right: 42px; }
.search-icon { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: .88rem; pointer-events: none; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 18px; flex-wrap: wrap; }
.page-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; font-family: inherit; font-size: .82rem; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Progress ── */
.progress-wrap { height: 5px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg,#1e40af,#0ea5e9); transition: width .6s; }

/* ── Info Rows ── */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text2); font-size: .83rem; }
.info-val   { font-weight: 700; font-size: .88rem; }

/* ── Customer Card ── */
.cust-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 15px; transition: all .2s; }
.cust-card:hover { border-color: var(--primary); box-shadow: 0 4px 20px rgba(30,64,175,.1); transform: translateY(-2px); }
.cust-amounts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin: 10px 0; }
.amt-box { background: var(--surface2); padding: 7px 6px; border-radius: 9px; text-align: center; }
.amt-val { font-size: .82rem; font-weight: 800; }
.amt-lbl { font-size: .62rem; color: var(--text3); margin-top: 1px; }

/* ── Worker Card ── */
.worker-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 15px; }
.worker-av   { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 800; flex-shrink: 0; color: #fff; }

/* ── Invoice Print ── */
.algerian-invoice { background: #fff; border-radius: 20px; padding: 26px; font-size: 12.5px; color: #1a202c; }
.inv-co-ar  { font-size: 1.45rem; font-weight: 900; color: #0b2b42; }
.inv-co-fr  { font-size: .85rem; color: #4a627a; margin-top: 2px; }
.inv-reg    { background: #f8fafc; padding: 7px 12px; border-radius: 18px; font-size: .62rem; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; }
.inv-table  { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .78rem; }
.inv-table th, .inv-table td { border: 1px solid #cbd5e1; padding: 7px 8px; text-align: center; }
.inv-table th { background: #eef2ff; font-weight: 700; }
.inv-total-row { display: flex; justify-content: flex-end; gap: 36px; padding: 5px 0; font-size: .82rem; }
.inv-total-row.grand { border-top: 2px solid #1e3a5f; padding-top: 7px; font-weight: 800; font-size: .9rem; }
.inv-sigs   { display: flex; justify-content: space-between; margin-top: 24px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.sig-box    { text-align: center; font-size: .72rem; color: #64748b; }
.sig-line   { border-top: 1px solid #aaa; margin: 28px auto 0; padding-top: 5px; width: 120px; }

/* ── Invoice Totals Bar (v4) ── */
.inv-totals-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.inv-total-chip { padding: 6px 14px; border-radius: 20px; font-size: .78rem; font-weight: 700; background: var(--surface2); border: 1px solid var(--border); color: var(--text2); }
.inv-total-chip.chip-green  { background: var(--success-light); color: var(--success); border-color: var(--success-light); }
.inv-total-chip.chip-danger { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger-light); }
.inv-total-chip.chip-blue   { background: var(--primary-light); color: var(--primary); border-color: var(--primary-light); }

/* ── Login ── */
#loginScreen { position: fixed; inset: 0; background: linear-gradient(135deg,#070d1a 0%,#0c1e3c 60%,#071428 100%); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
#loginScreen.visible { display: flex; }
.login-card  { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09); border-radius: 24px; padding: 34px 30px; width: 100%; max-width: 380px; backdrop-filter: blur(24px); }
.login-logo  { width: 68px; height: 68px; background: linear-gradient(135deg,#1e40af,#0ea5e9); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.9rem; margin: 0 auto 16px; box-shadow: 0 0 40px rgba(30,64,175,.4); }
.login-title { text-align: center; color: #fff; font-size: 1.7rem; font-weight: 900; }
.login-sub   { text-align: center; color: #475569; font-size: .82rem; margin-bottom: 26px; }
.login-input { width: 100%; padding: 11px 15px; background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.1); border-radius: 11px; color: #fff; font-family: inherit; font-size: .88rem; transition: all .2s; margin-bottom: 10px; }
.login-input:focus { outline: none; border-color: #3b82f6; background: rgba(255,255,255,.11); }
.login-input::placeholder { color: #334155; }
.login-btn   { width: 100%; padding: 12px; background: linear-gradient(135deg,#1e40af,#2563eb); border: none; border-radius: 11px; color: #fff; font-family: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; transition: all .2s; margin-top: 4px; }
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(30,64,175,.45); }
/* تم حذف login-tabs وlogin-tab — لا تسجيل من الخارج في v4 */

/* ── Filter / Tabs ── */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-btn { padding: 6px 13px; border-radius: 18px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; font-family: inherit; font-size: .78rem; font-weight: 600; transition: all .2s; }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-bar { display: flex; gap: 3px; background: var(--surface2); padding: 4px; border-radius: 11px; margin-bottom: 18px; overflow-x: auto; }
.tab-btn { flex-shrink: 0; padding: 7px 14px; border: none; background: transparent; color: var(--text2); border-radius: 7px; cursor: pointer; font-family: inherit; font-size: .8rem; font-weight: 600; transition: all .2s; }
.tab-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 44px 24px; }
.empty-icon  { font-size: 2.8rem; color: var(--text3); margin-bottom: 10px; }
.empty-title { font-size: .95rem; font-weight: 700; color: var(--text2); }
.empty-sub   { font-size: .82rem; color: var(--text3); margin-top: 5px; }

/* ── Invoice Builder ── */
.inv-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.item-row    { display: flex; gap: 7px; margin-bottom: 9px; align-items: center; }
.item-row .desc-inp { flex: 3; min-width: 0; }
.item-row .num-inp  { flex: 1; min-width: 0; }
.item-row .rm-btn   { width: 30px; height: 30px; border: none; background: var(--danger-light); color: var(--danger); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.add-item-btn { width: 100%; padding: 9px; border: 2px dashed var(--border); background: transparent; border-radius: 9px; color: var(--text3); cursor: pointer; font-family: inherit; font-size: .82rem; transition: all .2s; margin-top: 9px; }
.add-item-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Image Upload ── */
.img-upload-area { border: 2px dashed var(--border); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; transition: all .2s; background: var(--surface2); }
.img-upload-area:hover, .img-upload-area.drag { border-color: var(--primary); background: var(--primary-light); }
.img-upload-area.has-img { padding: 8px; border-style: solid; border-color: var(--success); }
.img-preview { max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 8px; display: block; margin: 0 auto; }
.img-thumb   { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid var(--border); }

/* ── Status Toggle ── */
.status-toggle { display: flex; gap: 8px; margin-bottom: 13px; }
.status-opt    { flex: 1; padding: 9px; border-radius: 10px; border: 2px solid var(--border); background: var(--surface2); color: var(--text2); cursor: pointer; font-family: inherit; font-size: .82rem; font-weight: 700; text-align: center; transition: all .2s; }
.status-opt.sel-debt { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.status-opt.sel-paid { border-color: var(--success); background: var(--success-light); color: var(--success); }

/* ── Phone Popup (v4) ── */
.phone-popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 600; display: flex; align-items: flex-end; justify-content: center; padding: 16px; animation: fadeIn .2s; }
.phone-popup { background: var(--surface); border-radius: 20px 20px 20px 20px; width: 100%; max-width: 360px; padding: 20px; animation: slideUp .25s cubic-bezier(.34,1.56,.64,1); }
.pp-title { font-size: .9rem; font-weight: 700; text-align: center; margin-bottom: 16px; color: var(--text2); }
.pp-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pp-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 14px; border: none; cursor: pointer; font-family: inherit; font-size: .72rem; font-weight: 700; transition: all .2s; }
.pp-btn i { font-size: 1.3rem; }
.pp-wa   { background: #d1fae5; color: #059669; }
.pp-wa:hover { background: #a7f3d0; }
.pp-call { background: var(--primary-light); color: var(--primary); }
.pp-call:hover { background: #bfdbfe; }
.pp-copy { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.pp-copy:hover { background: var(--border); }
.pp-close { width: 100%; padding: 10px; border: 1.5px solid var(--border); background: transparent; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: .84rem; color: var(--text2); font-weight: 600; }
.pp-close:hover { background: var(--surface2); }

/* ── Toggle Switch (v4) ── */
.toggle-switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 26px; cursor: pointer; transition: .3s; }
.toggle-slider:before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Checks Grid (v4 — invoice visibility) ── */
.checks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chk-label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--surface2); border: 1px solid var(--border); cursor: pointer; font-size: .82rem; font-weight: 600; transition: all .2s; }
.chk-label input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.chk-label:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── Settings Accordion (v4) ── */
.settings-accordion { display: flex; flex-direction: column; gap: 10px; }
.acc-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.acc-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; cursor: pointer; font-weight: 700; font-size: .9rem; transition: background .2s; user-select: none; }
.acc-header:hover { background: var(--surface2); }
.acc-arrow { transition: transform .3s; color: var(--text3); font-size: .8rem; }
.acc-item.open .acc-arrow { transform: rotate(180deg); }
.acc-body { padding: 0 18px 18px; display: none; }
.acc-item.open .acc-body { display: block; }

/* ── Customer Log (v4) ── */
.log-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.log-item:last-child { border-bottom: none; }
.log-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .85rem; flex-shrink: 0; }
.log-content { flex: 1; min-width: 0; }
.log-content .log-title { font-size: .83rem; font-weight: 700; }
.log-content .log-meta  { font-size: .72rem; color: var(--text3); margin-top: 2px; }
.log-content .log-note  { font-size: .8rem; color: var(--text2); margin-top: 4px; font-style: italic; }

/* ── Status Choice Buttons (v4 — customer status) ── */
.status-choice { padding: 8px 14px; border-radius: 20px; border: 2px solid var(--border); background: var(--surface2); color: var(--text2); cursor: pointer; font-family: inherit; font-size: .8rem; font-weight: 700; transition: all .2s; white-space: nowrap; }
.status-choice:hover { border-color: var(--text3); }
.status-choice.selected { border-color: var(--sc, var(--primary)); background: color-mix(in srgb, var(--sc, var(--primary)) 12%, transparent); color: var(--sc, var(--primary)); }

/* ── Utilities ── */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-purple  { color: var(--purple)  !important; }
.text-muted   { color: var(--text3)   !important; }
.fw-bold { font-weight: 700 !important; }
.fw-900  { font-weight: 900 !important; }
.d-flex  { display: flex; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px;  }
.gap-3  { gap: 12px; }
.mb-2   { margin-bottom: 8px;  }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mt-2   { margin-top: 8px;  }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.w-100  { width: 100%; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Mobile ── */
@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { position: fixed; top: 0; right: -280px; width: 280px; height: 100vh; z-index: 300; grid-row: unset; }
  #sidebar.open { right: 0; box-shadow: -4px 0 30px rgba(0,0,0,.5); }
  #sidebar-ov { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 299; display: none; backdrop-filter: blur(2px); }
  #sidebar-ov.show { display: block; }
  #menuToggle { display: flex !important; }
  #main { padding: 14px; padding-bottom: 76px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .inv-builder, .row-2, .row-3 { grid-template-columns: 1fr; }
  .checks-grid { grid-template-columns: 1fr; }
  #bottomNav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--nav-bg); display: flex; z-index: 200; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid rgba(255,255,255,.07); box-shadow: 0 -4px 20px rgba(0,0,0,.35); }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 4px 5px; cursor: pointer; color: #334155; transition: color .2s; text-decoration: none; font-size: .58rem; font-weight: 600; gap: 3px; }
  .bn-item i { font-size: 1.1rem; }
  .bn-item.active { color: #60a5fa; }
}
@media (min-width: 769px) { #bottomNav { display: none; } }

/* ── Print ── */
@media print {
  #topbar, #sidebar, #bottomNav, .no-print, .btn, #offlineBanner, #loadingOverlay { display: none !important; }
  #main { padding: 0; }
  body  { background: #fff; }
  .algerian-invoice { border-radius: 0; box-shadow: none; }
}

body.offline-mode #offlineBanner { transform: translateY(0); }
body.online-mode #offlineBanner { transform: translateY(-100%); }

/* ════════════════════════════════════════════
   Sofazi v4.1 — إضافات CSS
   ════════════════════════════════════════════ */

/* ── زر الإشعارات ─────────────────────────── */
#notifBadge {
  position: absolute; top: -5px; right: -5px;
  background: var(--danger); color: #fff;
  border-radius: 50%; min-width: 18px; height: 18px;
  display: none; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; padding: 0 3px;
  border: 2px solid var(--bg);
}

/* ── لوحة الإشعارات ──────────────────────── */
/* #notifPanel - moved to v4.1 section below */
/* np-* old classes - replaced */

/* ── إعدادات الإشعارات ─────────────────────── */
.np-sec-title {
  font-size: .8rem; font-weight: 700; color: var(--text2);
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.np-pref-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--surface2); border-radius: 9px;
  margin-bottom: 7px;
}
.np-pref-left { display:flex;align-items:center;gap:10px; }
.np-pref-ico  { width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:.8rem;flex-shrink:0; }
.np-pref-lbl  { font-size:.83rem;font-weight:500;color:var(--text1); }
.np-actions   { display:flex;gap:8px;margin-top:14px;flex-wrap:wrap; }

/* ── Toggle Switch ──────────────────────────── */
.sw { position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0; }
.sw input { opacity:0;width:0;height:0;position:absolute; }
.sw-knob {
  position:absolute;inset:0;background:var(--border);border-radius:12px;cursor:pointer;
  transition:.25s;
}
.sw-knob::before {
  content:'';position:absolute;left:3px;top:3px;width:18px;height:18px;
  background:#fff;border-radius:50%;transition:.25s;
}
.sw input:checked + .sw-knob { background:var(--primary); }
.sw input:checked + .sw-knob::before { transform:translateX(20px); }

/* ── واتساب ─────────────────────────────────── */
#waBtn { background:#25D366!important;border-color:#25D366!important;color:#fff!important; }
#waBtn:hover { background:#20b558!important;border-color:#20b558!important; }

/* ── صفحة Login ──────────────────────────────── */
.login-input::placeholder { color: var(--text3); }

/* ── مسح الكاش ───────────────────────────────── */
@media print { #waBtn, .no-print { display:none!important; } }

/* ════════════════════════════════════════════
   شاشة الإقلاع الذكية — Boot Screen
   ════════════════════════════════════════════ */

#bootOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0a0f1e 0%, #0f172a 50%, #1a0a2e 100%);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Tajawal', sans-serif;
}
.boot-fade-out {
  animation: bootFadeOut .4s ease forwards;
}
@keyframes bootFadeOut {
  to { opacity: 0; transform: scale(1.02); }
}

.boot-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  animation: bootCardIn .5s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 40px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.1);
}
@keyframes bootCardIn {
  from { opacity:0; transform:translateY(30px) scale(.95); }
  to   { opacity:1; transform:none; }
}

.boot-logo {
  text-align: center;
  margin-bottom: 24px;
}
.boot-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: bootSpin 3s linear infinite;
  display: inline-block;
}
@keyframes bootSpin {
  0%,100% { transform: rotate(0deg); }
  25%      { transform: rotate(10deg); }
  75%      { transform: rotate(-10deg); }
}
.boot-brand {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
}
.boot-version {
  font-size: .72rem;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
  letter-spacing: 1px;
}

.boot-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .75rem;
  font-weight: 700;
  margin: 0 auto 16px;
  display: flex;
  justify-content: center;
  animation: bootPulse 2s ease infinite;
}
@keyframes bootPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}

.boot-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  margin: 20px 0;
}

.boot-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 6px;
}
.boot-subtitle {
  font-size: .78rem;
  color: rgba(255,255,255,.45);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}

.boot-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.boot-mode-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  cursor: pointer;
  transition: all .2s;
  text-align: right;
  width: 100%;
  color: #fff;
}
.boot-mode-btn:hover {
  transform: translateX(-4px);
  border-color: rgba(255,255,255,.2);
}
.boot-online {
  border-color: rgba(16,185,129,.3);
  background: rgba(16,185,129,.08);
}
.boot-online:hover {
  background: rgba(16,185,129,.15);
  border-color: rgba(16,185,129,.5);
  box-shadow: 0 0 20px rgba(16,185,129,.15);
}
.boot-offline {
  border-color: rgba(139,92,246,.3);
  background: rgba(139,92,246,.08);
}
.boot-offline:hover {
  background: rgba(139,92,246,.15);
  border-color: rgba(139,92,246,.5);
  box-shadow: 0 0 20px rgba(139,92,246,.15);
}

.boot-mode-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.boot-online .boot-mode-icon { background: rgba(16,185,129,.2); color: #10b981; }
.boot-offline .boot-mode-icon{ background: rgba(139,92,246,.2); color: #8b5cf6; }

.boot-mode-body { flex: 1; }
.boot-mode-title {
  font-size: .92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}
.boot-mode-desc {
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  line-height: 1.4;
}
.boot-mode-arrow {
  color: rgba(255,255,255,.3);
  font-size: .8rem;
  flex-shrink: 0;
}

.boot-status {
  display: none;
  text-align: center;
  font-size: .8rem;
  color: rgba(255,255,255,.7);
  padding: 10px;
  background: rgba(255,255,255,.05);
  border-radius: 10px;
  margin-bottom: 12px;
  gap: 6px;
}

.boot-footer {
  text-align: center;
  margin-top: 12px;
}
.boot-conn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  padding: 4px 12px;
  border-radius: 20px;
}
.boot-conn.online {
  background: rgba(16,185,129,.15);
  color: #10b981;
}
.boot-conn.online .fas { font-size: .4rem; }
.boot-conn.offline {
  background: rgba(239,68,68,.15);
  color: #ef4444;
}
.boot-conn.offline .fas { font-size: .4rem; }

/* ════════════════════════════════════════════
   System Toast — إشعارات النظام المنبثقة
   ════════════════════════════════════════════ */
#systemToastContainer {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(380px, 95vw);
}
.sys-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  width: 100%;
  pointer-events: all;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity .25s, transform .25s;
}
.sys-toast.sys-toast-in  { opacity:1; transform:none; }
.sys-toast.sys-toast-out { opacity:0; transform:translateY(-8px); }
.sys-toast-icon { font-size: .9rem; flex-shrink: 0; width: 20px; text-align: center; }
.sys-toast-msg  { flex: 1; font-size: .82rem; font-weight: 500; color: var(--text); }
.sys-toast-close {
  background: none; border: none; color: var(--text3);
  cursor: pointer; padding: 2px 4px; font-size: .75rem;
  flex-shrink: 0; pointer-events: all;
}
.sys-toast-close:hover { color: var(--text); }

/* ════════════════════════════════════════════
   تحسينات لوحة الإشعارات
   ════════════════════════════════════════════ */
.np-unread-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 4px;
  margin-right: 4px; vertical-align: middle;
}
.np-item-unread { background: var(--primary-light) !important; }
.np-item-clickable { cursor: pointer; }
.np-item-clickable:hover { background: var(--surface2) !important; }
.np-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0;
}

/* ════════════════════════════════════════════
   Dashboard — تحسينات البطاقات
   ════════════════════════════════════════════ */
.card { transition: box-shadow .2s; }
.card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.1); }
body.dark .card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.4); }

/* ════════════════════════════════════════════
   System Toast — sysToastBox
   ════════════════════════════════════════════ */
#sysToastBox {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%);
  z-index: 99998; display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none;
  width: min(380px, 94vw);
}
.syt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  width: 100%; pointer-events: all;
  opacity: 0; transform: translateY(-10px) scale(.97);
  transition: opacity .22s ease, transform .22s ease;
}
body.dark .syt { box-shadow: 0 4px 20px rgba(0,0,0,.5); }
.syt.syt-in  { opacity: 1; transform: none; }
.syt.syt-out { opacity: 0; transform: translateY(-8px); }
.syt-ic  { font-size: .9rem; flex-shrink: 0; width: 20px; text-align: center; }
.syt-msg { flex: 1; font-size: .82rem; font-weight: 500; color: var(--text); }
.syt-x   { background: none; border: none; color: var(--text3); cursor: pointer;
            padding: 2px 5px; font-size: .72rem; flex-shrink: 0; line-height: 1; }
.syt-x:hover { color: var(--text); }

/* ════════════════════════════════════════════
   Notification Panel — np-*
   ════════════════════════════════════════════ */
#notifPanel {
  position: fixed; top: 62px; left: 16px; z-index: 9999;
  width: 340px; max-height: 76vh;
  background: var(--surface) !important;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
  animation: npSlide .18s ease;
}
body.dark #notifPanel {
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
@keyframes npSlide { from { opacity:0; transform:translateY(-8px) scale(.98); } to { opacity:1; transform:none; } }
.np-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: .93rem; color: var(--text);
  background: var(--surface); border-radius: 16px 16px 0 0;
}
.np-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 4px;
}
.np-btn-sm {
  background: var(--surface2); border: none; border-radius: 6px;
  padding: 3px 8px; font-size: .72rem; cursor: pointer; color: var(--text2);
  font-family: inherit;
}
.np-btn-sm:hover { color: var(--text); }
.np-btn-close {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: 1rem; padding: 4px; line-height: 1;
}
.np-btn-close:hover { color: var(--text); }
.np-body { overflow-y: auto; flex: 1; background: var(--surface); }
.np-empty { padding: 40px 20px; text-align: center; color: var(--text3); line-height: 2.2; }
.np-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); transition: background .15s;
}
.np-item:last-child { border-bottom: none; }
.np-unread { background: var(--primary-light) !important; }
.np-click  { cursor: pointer; }
.np-click:hover { background: var(--surface2) !important; }
.np-ic {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0;
}
.np-body-text { flex: 1; min-width: 0; }
.np-msg  { font-size: .82rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.np-date { font-size: .68rem; color: var(--text3); margin-top: 3px; }
.np-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 4px; }
.np-foot {
  padding: 10px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; background: var(--surface); border-radius: 0 0 16px 16px;
}

/* إعدادات الإشعارات */
.np-sec-title {
  font-size: .8rem; font-weight: 700; color: var(--text2);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.np-pref-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; background: var(--surface2); border-radius: 9px; margin-bottom: 6px;
}
.np-pref-left { display: flex; align-items: center; gap: 10px; }
.np-pref-ico  { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.np-pref-lbl  { font-size: .82rem; font-weight: 500; color: var(--text); }
.np-actions   { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Toggle Switch */
.sw { position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0; }
.sw input { opacity:0;width:0;height:0;position:absolute; }
.sw-knob { position:absolute;inset:0;background:var(--border);border-radius:12px;cursor:pointer;transition:.22s; }
.sw-knob::before { content:'';position:absolute;left:3px;top:3px;width:18px;height:18px;background:#fff;border-radius:50%;transition:.22s; }
.sw input:checked+.sw-knob { background:var(--primary); }
.sw input:checked+.sw-knob::before { transform:translateX(20px); }

/* notifBadge */
#notifBadge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  border-radius: 50%; min-width: 17px; height: 17px;
  display: none; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; padding: 0 2px;
  border: 2px solid var(--nav-bg);
}



/* ════════════════════════════════════════════
   ختم المؤسسة الحقيقي في الفاتورة
   ════════════════════════════════════════════ */
.inv-stamp-area {
  display: flex;
  justify-content: flex-start;
  margin: 18px 0 10px;
}

.inv-stamp-img {
  max-width: 260px;
  width: 100%;
  height: auto;
  opacity: 0.92;
  /* تأثير الختم الأصلي */
  mix-blend-mode: multiply;
  filter: contrast(1.1) brightness(0.95);
}

/* عند الطباعة */
@media print {
  .inv-stamp-area {
    margin: 14px 0 6px;
  }
  .inv-stamp-img {
    max-width: 240px;
    opacity: 1;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    mix-blend-mode: multiply;
  }
}

/* ═══════════════════════════════════════════════
   ختم المؤسسة الإلكتروني — SVG Vector
   ═══════════════════════════════════════════════ */
.inv-stamp-area {
  display: flex;
  justify-content: flex-end;   /* يمين الفاتورة */
  margin: 16px 0 8px;
}

.inv-stamp-img {
  width: 280px;
  max-width: 300px;
  height: auto;
  opacity: 0.88;
  /* يجعل الخلفية البيضاء شفافة على الفاتورة */
  mix-blend-mode: multiply;
}

/* الطباعة */
@media print {
  .inv-stamp-area {
    margin: 12px 0 4px;
    justify-content: flex-end;
  }
  .inv-stamp-img {
    width: 260px;
    opacity: 0.92;
    mix-blend-mode: multiply;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* */
