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

:root {
  --bg: #edf3f7;
  --panel: #ffffff;
  --ink: #0a1c2b;
  --muted: #465a6b;
  --line: #d5e1ea;
  --brand: #0a6c95;
  --brand-2: #084e6d;
  --brand-soft: #e1f1f8;
  --accent: #0fb5a6;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --ok: #17864f;
  --warn: #b7791f;
  --side: #062536;
  --side-2: #0a3b53;
  --side-ink: #d6e7f1;
  --side-active: rgba(15, 181, 166, .2);
  --shadow: 0 1px 2px rgba(10, 28, 43, .06), 0 6px 18px rgba(10, 28, 43, .07);
  --radius: 12px;
  --egp: #17864f; --usd: #1d4ed8; --eur: #6d28d9; --gbp: #c2410c;
  /* ألوان الأعمدة: التسجيل / المحسوب / بيانات النظام */
  --ecol-h: #d9ecf8; --ecol-hi: #0a4a69;
  --vcol-h: #cff1e4; --vcol-hi: #0b6b4c; --vcol-c: #eefaf5;
  --meta-h: #ebe7f6; --meta-hi: #56478a; --meta-c: #f8f6fc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b141b; --panel: #111d27; --ink: #eaf2f8; --muted: #a3b4c3; --line: #253644;
    --brand: #3fb0dc; --brand-2: #8ad0ec; --brand-soft: #123447; --side: #061019; --side-2: #0a2233; --side-active: rgba(15,181,166,.22);
    --danger-soft: #3a1714; --shadow: 0 1px 2px rgba(0,0,0,.4);
    --egp: #4ade80; --usd: #60a5fa; --eur: #a78bfa; --gbp: #fb923c;
    --ecol-h: #15344a; --ecol-hi: #9fd6ef; --vcol-h: #123a2e; --vcol-hi: #7fe0b8; --vcol-c: #0f2a22; --meta-h: #2a2540; --meta-hi: #c7bcf0; --meta-c: #1a1829;
  }
}
:root[data-theme="dark"] {
  --bg: #0b141b; --panel: #111d27; --ink: #eaf2f8; --muted: #a3b4c3; --line: #253644;
  --brand: #3fb0dc; --brand-2: #8ad0ec; --brand-soft: #123447; --side: #061019; --side-2: #0a2233; --side-active: rgba(15,181,166,.22);
  --danger-soft: #3a1714; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --egp: #4ade80; --usd: #60a5fa; --eur: #a78bfa; --gbp: #fb923c;
  --ecol-h: #15344a; --ecol-hi: #9fd6ef; --vcol-h: #123a2e; --vcol-hi: #7fe0b8; --vcol-c: #0f2a22; --meta-h: #2a2540; --meta-hi: #c7bcf0; --meta-c: #1a1829;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font, 'Cairo'), 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }

/* ——— layout ——— */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.brand .logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #0b6e99, #14b8a6); display: grid; place-items: center; font-weight: 800; color: #fff; }
.brand b { color: #fff; font-size: 16px; display: block; }
.brand small { color: #7f9cb0; font-size: 11px; }
.nav-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11px; color: #6f8ea3; font-weight: 700; letter-spacing: .3px; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 13.5px;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 700; }
.nav a .ic { width: 18px; text-align: center; opacity: .85; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.menu-btn { display: none; }
.content { padding: 20px 24px 40px; }

/* ——— common ——— */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; }
.card-b { padding: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; font-size: 13px;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn.del:hover { background: var(--danger-soft); color: var(--danger); }
input, select, textarea {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 10px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="checkbox"] { width: auto; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
label.f .req { color: var(--danger); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-2); font-size: 11.5px; font-weight: 700; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }

/* ——— toolbar ——— */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input[type="date"] { width: 150px; }
.toolbar input.search { width: 220px; }
.toolbar .sep { flex: 1; }

/* ——— table ——— */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 250px); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; }
table.grid th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-weight: 700; color: var(--muted); font-size: 12px; border-bottom: 2px solid var(--line); cursor: pointer; user-select: none; }
table.grid th:hover { color: var(--brand); }
table.grid tbody tr:hover td { background: var(--brand-soft); }
table.grid td.n { text-align: left; font-variant-numeric: tabular-nums; direction: ltr; }
table.grid tfoot td { position: sticky; bottom: 0; background: var(--panel); font-weight: 800; border-top: 2px solid var(--line); }
table.grid td.act { width: 1%; }
table.grid td.idx { color: var(--muted); font-size: 11px; }
.cur-EGP { color: var(--egp); } .cur-USD { color: var(--usd); } .cur-EUR { color: var(--eur); } .cur-GBP { color: var(--gbp); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ——— dashboard ——— */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.rate { padding: 16px; position: relative; overflow: hidden; }
.rate .code { font-size: 12px; color: var(--muted); font-weight: 700; }
.rate .val { font-size: 28px; font-weight: 800; margin: 2px 0; }
.rate .sub { font-size: 12px; color: var(--muted); }
.rate .flag { position: absolute; left: 14px; top: 14px; font-size: 26px; opacity: .9; }
.rate.USD .val { color: var(--usd); } .rate.EUR .val { color: var(--eur); } .rate.GBP .val { color: var(--gbp); }
.diff.up { color: var(--ok); } .diff.down { color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid .full { grid-column: 1 / -1; }
.stat { padding: 14px 16px; }
.stat .t { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat .v { font-size: 24px; font-weight: 800; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-inline-end: 6px; animation: pulse 1.6s infinite; }
.live-dot.off { background: var(--danger); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(30,142,90,.6); } 100% { box-shadow: 0 0 0 8px rgba(30,142,90,0); } }

/* ——— modal ——— */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 20, 30, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(980px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.sm { width: min(460px, 100%); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-h h3 { margin: 0; font-size: 16px; }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.form-sec { grid-column: 1 / -1; font-size: 12px; font-weight: 800; color: var(--brand); border-bottom: 1px dashed var(--line); padding-bottom: 4px; margin-top: 6px; }
.calc { display: flex; gap: 4px; } .calc input { flex: 1; }

/* ——— login ——— */
.login-bg { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 80% -10%, #1aa3c9 0%, transparent 60%), linear-gradient(160deg, #06263a, #0b4f70 60%, #0d7c8f); }
.login { width: min(400px, 100%); padding: 28px; }
.login h2 { margin: 6px 0 2px; }
.login .brand { border: 0; padding: 0 0 10px; }
.login .brand b { color: var(--ink); }

/* ——— lists / perms ——— */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--brand-soft); font-size: 12.5px; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0 4px; }
.chip button:hover { color: var(--danger); }
table.perms td, table.perms th { text-align: center; padding: 4px 8px; }
table.perms td:first-child, table.perms th:first-child { text-align: right; }

#toast { position: fixed; bottom: 20px; left: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; max-width: 420px; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 260px; z-index: 40; transform: translateX(100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .dash-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .toolbar input.search { width: 100%; }
}
@media print {
  .side, .topbar, .toolbar, .act, .pager { display: none !important; }
  .layout { display: block; } .tbl-wrap { max-height: none; overflow: visible; }
}

.bell-n { position: absolute; top: -4px; left: -6px; background: var(--danger); color: #fff; border-radius: 99px; font-size: 10px; font-weight: 800; padding: 0 5px; line-height: 16px; }
.nav a .pill { background: #c0392b; color: #fff; }
table.grid th[rowspan], table.grid th[colspan] { cursor: default; }

/* النموذج: زر الحفظ يفضل ظاهر حتى في الشاشات القصيرة */
.modal { overflow: hidden; }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* أعمدة Total المحسوبة */
table.grid th.vcol { color: var(--brand); }
table.grid td.vcol { background: var(--brand-soft); font-weight: 700; }
label.f.vfield { color: var(--brand); }
label.f.vfield input { background: var(--brand-soft); font-weight: 800; border-color: var(--brand); }
table.grid td.c { text-align: center; }
table.grid input.tg { width: 18px; height: 18px; cursor: pointer; accent-color: var(--ok); }
.chkbox { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-weight: 800; color: var(--ok); }
.chkbox input { width: 20px; height: 20px; accent-color: var(--ok); }
table.grid th.meta, table.grid td.meta { color: var(--muted); font-size: 12px; }
.meta-box { background: var(--brand-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: 12.5px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.filters .fl { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); font-weight: 700; }
.filters select { width: 170px; padding: 5px 8px; }
.filters select.on { border-color: var(--brand); background: var(--brand-soft); font-weight: 700; color: var(--brand-2); }
.price-hint { background: #fff8e6; border: 1px solid #f5d27a; color: #7a5200; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; }
:root[data-theme="dark"] .price-hint { background: #3a2e10; color: #f5d27a; border-color: #6b5520; }
/* أقسام شاشة الإضافة */
.form-sec { grid-column: 1 / -1; font-size: 13px; font-weight: 800; color: var(--brand); background: var(--brand-soft); border-radius: 8px; padding: 6px 12px; margin-top: 8px; border-bottom: 0; }
.form-sec:first-child { margin-top: 0; }
.form-sec.sec-act { color: #0f766e; background: #ccfbf1; }
.form-sec.sec-cur { color: #1d4ed8; background: #dbeafe; }
.form-sec.sec-col { color: #15803d; background: #dcfce7; }
.form-sec.sec-tot { color: #7c2d12; background: #ffedd5; }
:root[data-theme="dark"] .form-sec.sec-act, :root[data-theme="dark"] .form-sec.sec-cur, :root[data-theme="dark"] .form-sec.sec-col, :root[data-theme="dark"] .form-sec.sec-tot { background: var(--brand-soft); color: var(--brand-2); }
input.fixed { background: var(--bg); color: var(--muted); font-weight: 700; cursor: not-allowed; }
.list-group { margin-bottom: 22px; }
.lg-title { font-size: 15px; margin: 0 0 10px; padding: 8px 12px; background: var(--brand-soft); color: var(--brand-2); border-radius: 8px; }
.dlg-bg { z-index: 80; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { color: #fff; opacity: .9; }
/* قائمة الاختيارات */
.combo { position: fixed; z-index: 90; background: var(--panel); border: 1px solid var(--brand); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-height: 240px; overflow-y: auto; padding: 4px; direction: rtl; }
.combo-it { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.combo-it:hover, .combo-it.on { background: var(--brand-soft); color: var(--brand-2); font-weight: 700; }
.combo-empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }
.chip button.mv { font-weight: 800; padding: 0 3px; opacity: .45; }
.chip:hover button.mv { opacity: 1; }
.chip button.mv:hover { color: var(--brand); }
.chip button.mv:disabled { visibility: hidden; }
.devbox { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #fff8e6; border: 1px solid #f5d27a; color: #7a5200; white-space: pre-line; font-size: 13px; line-height: 1.8; }


/* ═════════ v26: الشكل الجديد (بحري) + خط أوضح ═════════ */
body { font-size: 15px; font-weight: 500; line-height: 1.6; -webkit-font-smoothing: antialiased; }
.side { background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); box-shadow: -2px 0 12px rgba(0,0,0,.12); }
.brand .logo { background: linear-gradient(135deg, #0a6c95, #0fb5a6); box-shadow: 0 4px 12px rgba(15,181,166,.35); }
.brand b { font-size: 17px; }
.brand small { color: #8fb3c7; font-size: 12px; }
.nav-group { font-size: 12px; color: #7fd3c9; font-weight: 800; margin: 16px 0 6px; }
.nav a { font-size: 14.5px; padding: 8px 12px; margin: 1px 0; border-inline-start: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.active { background: var(--side-active); border-inline-start-color: var(--accent); color: #fff; }
.topbar { box-shadow: 0 1px 0 var(--line), 0 2px 10px rgba(10,28,43,.04); }
.topbar h1 { font-size: 20px; font-weight: 800; color: var(--brand-2); }
.card-h h2, .card-h h3 { font-size: 16px; font-weight: 800; }
.card-h { background: linear-gradient(180deg, rgba(225,241,248,.55), transparent); border-radius: var(--radius) var(--radius) 0 0; }
.btn { font-size: 14px; font-weight: 600; padding: 8px 14px; }
.btn.sm { font-size: 13px; padding: 4px 10px; }
.btn.primary { background: linear-gradient(135deg, var(--brand), #0b7fa8); box-shadow: 0 2px 6px rgba(10,108,149,.25); }
input, select, textarea { font-size: 14.5px; padding: 8px 11px; }
label.f { font-size: 13.5px; color: var(--ink); font-weight: 700; }
.muted { color: var(--muted); }
.form-sec { font-size: 13.5px; }

/* الجداول */
table.grid { font-size: 14px; }
table.grid th, table.grid td { padding: 8px 11px; }
table.grid th { font-size: 13px; font-weight: 800; color: var(--ink); border-bottom: 2px solid var(--line); }
table.grid td { color: var(--ink); }
table.grid tbody tr:nth-child(even) td { background-color: rgba(10,108,149,.025); }
table.grid tbody tr:hover td { background: var(--brand-soft); }
table.grid td.n { font-weight: 600; }
table.grid td.idx { font-size: 12px; }
/* أعمدة التسجيل */
table.grid th.ecol { background: var(--ecol-h); color: var(--ecol-hi); }
/* أعمدة محسوبة */
table.grid th.vcol { background: var(--vcol-h); color: var(--vcol-hi); }
table.grid td.vcol { background: var(--vcol-c); font-weight: 800; color: var(--vcol-hi); }
table.grid tbody tr:hover td.vcol { background: var(--vcol-h); }
/* بيانات النظام */
table.grid th.meta { background: var(--meta-h); color: var(--meta-hi); font-size: 12.5px; }
table.grid td.meta { background: var(--meta-c); color: var(--meta-hi); font-size: 12.5px; font-weight: 500; }
table.grid tfoot td { background: #e9f2f7; color: var(--ink); }
table.grid tfoot td.vcol { background: var(--vcol-h); }
:root[data-theme="dark"] table.grid tfoot td { background: #15273a; }
.col-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 700; }
.col-legend .lg { padding: 2px 10px; border-radius: 99px; }
.col-legend .lg.ecol { background: var(--ecol-h); color: var(--ecol-hi); }
.col-legend .lg.vcol { background: var(--vcol-h); color: var(--vcol-hi); }
.col-legend .lg.meta { background: var(--meta-h); color: var(--meta-hi); }

/* لوحة التحكم */
.stat .t { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 26px; }
.rate .val { font-size: 30px; }

/* التقارير */
.rep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rep-kpis .card { padding: 14px 16px; border-top: 4px solid var(--brand); }
.rep-kpis .card.ok { border-top-color: var(--ok); } .rep-kpis .card.bad { border-top-color: var(--danger); } .rep-kpis .card.tq { border-top-color: var(--accent); }
.rep-kpis .t { font-size: 13px; color: var(--muted); font-weight: 700; }
.rep-kpis .v { font-size: 24px; font-weight: 800; }
.rep-kpis .s { font-size: 12.5px; color: var(--muted); }
.rep-sec { margin-bottom: 16px; }
.print-only { display: none; }
@media print {
  body { font-size: 12px; background: #fff; }
  .print-only { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
  .rep-sec { break-inside: auto; }
  table.grid th { position: static; }
  .col-legend, .no-print { display: none !important; }
}
.pbar { height: 7px; background: var(--line); border-radius: 99px; margin: 2px 0; overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 99px; }
.pbar i.r { background: var(--ok); } .pbar i.e { background: var(--danger); }
/* بيانات الشركة */
.brand .logo-img { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; padding: 2px; }
.logo-edit { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.logo-prev { width: 104px; height: 104px; border: 2px dashed var(--line); border-radius: 14px; display: grid; place-items: center; }
.logo-prev .logo { display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #0a6c95, #0fb5a6); color: #fff; font-weight: 800; }
.co-head { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 12px; font-size: 12.5px; }
.co-head img { width: 70px; height: 70px; object-fit: contain; }
.co-head b { font-size: 20px; display: block; }
.co-head small { color: var(--muted); display: block; font-size: 12.5px; }
@media print { #printHead { padding: 10px 24px 0; } }
/* كشف حساب العملاء */
.cs-head { margin-bottom: 14px; }
table.cs-info { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 14px; }
table.cs-info td { padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.cs-info td:nth-child(odd) { color: var(--muted); font-weight: 700; width: 12%; background: var(--brand-soft); }
.cs-final { margin-top: 14px; padding: 12px 16px; border: 2px solid var(--brand); border-radius: 12px; background: var(--panel); display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 15px; }
.cs-sign { display: none; margin-top: 50px; }
@media print {
  .cs-sign { display: flex !important; justify-content: space-between; text-align: center; }
  .cs-sign > div { width: 40%; }
  .kpis { display: none; }
  table.cs-info td:nth-child(odd) { background: #eef3f7 !important; }
}
table.cs-sum td:first-child { white-space: normal; }
table.cs-sum tfoot td { font-size: 15px; }
@media print {
  /* مقاس الصفحة A4 — بالطول أو بالعرض حسب الصفحة (بيتحدد من app.js: pageOrient) */
  .tbl-wrap { overflow: visible !important; }
  table.grid { font-size: 8.5px; }
  table.grid th, table.grid td { padding: 3px 4px; white-space: normal; }
}
/* ═════ فاتورة / كشف حساب العميل (شكل بسيط) ═════ */
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.wa:hover { background: #178a45; color: #fff; }
.inv { background: #fff; color: #1b2733; border: 1px solid var(--line); border-radius: 12px; padding: 28px 30px; max-width: 100%; box-shadow: var(--shadow); font-size: 14px; }
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 16px; border-bottom: 3px solid #0a6c95; }
.inv-co { display: flex; gap: 12px; align-items: center; font-size: 12.5px; color: #55636f; }
.inv-co img { width: 64px; height: 64px; object-fit: contain; }
.inv-co b { font-size: 19px; color: #0a1c2b; display: block; margin-bottom: 2px; }
.inv-title { text-align: left; font-size: 12.5px; color: #55636f; }
.inv-title h2 { margin: 0 0 4px; font-size: 26px; color: #0a6c95; letter-spacing: .5px; }
.inv-to { display: grid; grid-template-columns: 1.4fr 1.2fr 1fr 1.2fr; gap: 0; margin: 18px 0; border: 1px solid #dde5ec; border-radius: 10px; overflow: hidden; }
.inv-to > div { padding: 10px 14px; border-inline-start: 1px solid #dde5ec; display: flex; flex-direction: column; gap: 2px; }
.inv-to > div:first-child { border-inline-start: 0; }
.inv-to span { font-size: 11.5px; color: #6b7a87; font-weight: 700; }
.inv-to b { font-size: 15px; }
.inv-to small { font-size: 12px; color: #55636f; }
.inv-to .due { background: #f3f8fb; }
.inv-to .due b { font-size: 20px; }
.inv h4 { margin: 18px 0 8px; font-size: 14px; color: #0a6c95; }
.inv-scroll { overflow-x: auto; }
table.inv-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.inv-t th { background: #f1f5f8; color: #37474f; font-weight: 700; padding: 7px 8px; border-bottom: 1px solid #cfd9e1; white-space: nowrap; text-align: right; }
table.inv-t td { padding: 6px 8px; border-bottom: 1px solid #edf1f4; white-space: nowrap; }
table.inv-t td.n { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
table.inv-t td.c { text-align: center; }
table.inv-t .b { font-weight: 800; }
table.inv-t tfoot td { font-weight: 800; border-top: 2px solid #cfd9e1; border-bottom: 0; background: #fafcfd; }
.inv-empty { color: #8a97a3; margin: 4px 0; font-size: 13px; }
.inv-warn { color: var(--warn); font-size: 13px; }
.inv-bottom { display: flex; justify-content: space-between; gap: 24px; margin-top: 20px; align-items: flex-start; }
.inv-note { flex: 1; font-size: 13px; color: #55636f; }
table.inv-sum { border-collapse: collapse; min-width: 380px; font-size: 13.5px; }
table.inv-sum th { font-size: 11.5px; color: #6b7a87; padding: 4px 10px; text-align: left; }
table.inv-sum th:first-child { text-align: right; }
table.inv-sum td { padding: 6px 10px; border-bottom: 1px solid #edf1f4; }
table.inv-sum td.n { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
table.inv-sum .b { font-weight: 800; }
table.inv-sum tr.minus td:first-child::before { content: '− '; color: #8a97a3; }
table.inv-sum tfoot td { background: #0a6c95; color: #fff; font-weight: 800; font-size: 15px; padding: 9px 10px; border: 0; }
.inv-sign { display: flex; justify-content: space-between; margin-top: 46px; font-size: 13px; color: #55636f; }
.inv-sign > div { width: 32%; text-align: center; border-top: 1px solid #9aa7b2; padding-top: 6px; }
.inv-foot { margin-top: 22px; text-align: center; font-size: 11.5px; color: #8a97a3; border-top: 1px dashed #dde5ec; padding-top: 10px; }
:root[data-theme="dark"] .inv { filter: none; }
@media (max-width: 900px) { .inv { padding: 16px; } .inv-to { grid-template-columns: 1fr 1fr; } .inv-bottom { flex-direction: column; } table.inv-sum { min-width: 0; width: 100%; } }
@media print {
  body:has(.inv) #printHead { display: none !important; }
  .inv { border: 0; box-shadow: none; padding: 0; border-radius: 0; font-size: 11px; }
  .inv-scroll { overflow: visible; }
  table.inv-t { font-size: 8px; }
  table.inv-t th, table.inv-t td { padding: 3px 3px; white-space: normal; }
  table.inv-t th { background: #f1f5f8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.inv-sum tfoot td, .inv-to .due { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-top { break-inside: avoid; } .inv-bottom, .inv-sign { break-inside: avoid; }
}
@media print { .inv-to { margin: 10px 0; } .inv h4 { margin: 10px 0 5px; } .inv-bottom { margin-top: 12px; } .inv-sign { margin-top: 30px; } .inv-top { padding-bottom: 10px; } }
/* ═════ ألوان الأزرار ═════ */
.btn.xl, .btn.pdf, .btn.wa, .btn.pr, .btn.im, .btn.tp { color: #fff; border: 0; font-weight: 700; box-shadow: 0 2px 6px rgba(10, 28, 43, .15); }
.btn.xl { background: linear-gradient(135deg, #1f7a4d, #2e9e64); }
.btn.pdf { background: linear-gradient(135deg, #b8322a, #d9534a); }
.btn.wa { background: linear-gradient(135deg, #14a085, #25c28f); }
.btn.pr { background: linear-gradient(135deg, #0a5f86, #1583b5); }
.btn.im { background: linear-gradient(135deg, #b86e0a, #dc8f1f); }
.btn.tp { background: linear-gradient(135deg, #56657a, #74839a); }
.btn.xl:hover, .btn.pdf:hover, .btn.wa:hover, .btn.pr:hover, .btn.im:hover, .btn.tp:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }
/* ═════ وضع PDF (زي الطباعة) ═════ */
.pdf-mode, .pdf-mode * { letter-spacing: 0 !important; }
.pdf-mode #content .toolbar, .pdf-mode #content .act, .pdf-mode #content .pager, .pdf-mode #content .no-print, .pdf-mode #content .filters { display: none !important; }
.pdf-mode #content .print-only { display: block !important; }
.pdf-mode #content { width: 1300px; max-width: none; background: #fff; }
.pdf-mode #content .inv { width: 1300px; max-width: none; border: 0; box-shadow: none; }
.pdf-mode #content .tbl-wrap, .pdf-mode #content .inv-scroll { overflow: visible !important; max-height: none !important; }
.pdf-mode #content table.grid th { position: static; }
.pdf-mode #content table.grid, .pdf-mode #content table.inv-t { font-size: 10.5px; }
.pdf-mode #content table.grid th, .pdf-mode #content table.grid td { padding: 4px 6px; }
.pdf-mode #content table.inv-t th, .pdf-mode #content table.inv-t td { white-space: normal; padding: 4px 5px; }
.pdf-mode #content table.grid tfoot td { position: static; }
.pdf-head { background: #fff; padding: 4px 0 0; }
/* ═════ إجماليات كشف الحساب ═════ */
.sum-wrap { margin-top: 16px; display: grid; grid-template-columns: minmax(260px, 1.1fr) 2fr; gap: 14px; align-items: stretch; }
.sum-hero { background: linear-gradient(135deg, #0a5f86 0%, #0fb5a6 100%); color: #fff; border-radius: 16px; padding: 20px 22px; box-shadow: 0 6px 20px rgba(10, 95, 134, .25); display: flex; align-items: center; }
.sum-hero-l { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.sum-hero span { font-size: 13.5px; opacity: .9; font-weight: 700; }
.sum-hero b { font-size: 34px; font-weight: 800; line-height: 1.1; }
.sum-hero b small { font-size: 15px; opacity: .85; }
.sum-hero > div > small { font-size: 12.5px; opacity: .9; }
.sum-bar { height: 8px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.sum-bar i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.sum-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.sum-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); border-top: 4px solid var(--brand); display: flex; flex-direction: column; gap: 2px; }
.sum-tile.cur-b-EGP { border-top-color: var(--egp); } .sum-tile.cur-b-USD { border-top-color: var(--usd); } .sum-tile.cur-b-EUR { border-top-color: var(--eur); } .sum-tile.cur-b-GBP { border-top-color: var(--gbp); }
.sum-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--muted); }
.sum-top em { font-style: normal; font-size: 11px; background: var(--brand-soft); padding: 0 8px; border-radius: 99px; }
.sum-tile > b { font-size: 26px; font-weight: 800; }
.sum-tile.cur-b-EGP > b { color: var(--egp); } .sum-tile.cur-b-USD > b { color: var(--usd); } .sum-tile.cur-b-EUR > b { color: var(--eur); } .sum-tile.cur-b-GBP > b { color: var(--gbp); }
.sum-tile > small { font-size: 11.5px; color: var(--muted); margin-top: -4px; }
.sum-sub { display: flex; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; font-size: 12px; color: var(--muted); }
.sum-sub b { color: var(--ink); font-weight: 700; }
@media (max-width: 900px) { .sum-wrap { grid-template-columns: 1fr; } }
@media print { .sum-hero, .sum-bar i { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* ═════ تقارير العملاء ═════ */
.shr { position: relative; min-width: 110px; height: 20px; background: var(--brand-soft); border-radius: 6px; overflow: hidden; }
.shr i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #0fb5a6, #0a6c95); opacity: .35; }
.shr span { position: relative; font-size: 12px; font-weight: 700; padding: 0 6px; line-height: 20px; }
.aging-bar { display: flex; gap: 6px; margin-bottom: 14px; min-height: 86px; }
.aging-bar .ag { min-width: 120px; border-radius: 12px; padding: 10px 12px; color: #fff; display: flex; flex-direction: column; justify-content: center; box-shadow: var(--shadow); }
.aging-bar .ag span { font-size: 12px; opacity: .92; font-weight: 700; }
.aging-bar .ag b { font-size: 20px; font-weight: 800; }
.aging-bar .ag small { font-size: 11.5px; opacity: .9; }
.ag0 { background: linear-gradient(135deg, #17864f, #2eb872); } .ag1 { background: linear-gradient(135deg, #b7791f, #e0a33a); }
.ag2 { background: linear-gradient(135deg, #c2410c, #ea6a2f); } .ag3 { background: linear-gradient(135deg, #9b1c1c, #d33a3a); }
table.grid th.agh0 { color: #17864f; } table.grid th.agh1 { color: #b7791f; } table.grid th.agh2 { color: #c2410c; } table.grid th.agh3 { color: #b42318; }
table.grid td.late { color: #b42318; font-weight: 800; }
@media print { .aging-bar .ag, .shr i { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* إصلاح: رأس الكروت في الوضع الليلي */
:root[data-theme="dark"] .card-h { background: linear-gradient(180deg, rgba(63,176,220,.08), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card-h { background: linear-gradient(180deg, rgba(63,176,220,.08), transparent); } }
:root[data-theme="dark"] table.grid tfoot td { background: #15273a; }
:root[data-theme="dark"] table.grid tbody tr:nth-child(even) td { background-color: rgba(255,255,255,.02); }
/* ═════ المصاريف العامه ═════ */
.sum-hero.exp { background: linear-gradient(135deg, #8f2a22 0%, #d9534a 100%); box-shadow: 0 6px 20px rgba(184, 50, 42, .25); }
.exp-grp { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; background: var(--panel); }
.exp-grp-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--brand-soft); border-bottom: 1px solid var(--line); font-size: 14px; }
.exp-grp-h > b:first-child { font-size: 16px; color: var(--brand-2); }
.exp-grp-h .sep { flex: 1; }
/* زرار "اليوم" أحمر */
.btn.today { background: linear-gradient(135deg, #b8322a, #d9534a); border-color: #b8322a; color: #fff; font-weight: 700; }
.btn.today:hover { color: #fff; filter: brightness(1.08); }
/* السيتويشن والنهائي: الطباعة من غير أعمدة الإضافة والتعديل */
@media print { table.sit-tbl .meta { display: none !important; } }
.pdf-mode table.sit-tbl .meta { display: none !important; }
@media print { table.sit-tbl .trn-col { display: none !important; } }
.pdf-mode table.sit-tbl .trn-col { display: none !important; }
/* ═════ القائمة الجانبية: مقفولة، بتتفتح بـ ☰ وبتتقفل أوتوماتيك ═════ */
.layout { grid-template-columns: 1fr !important; }
.menu-btn { display: inline-flex !important; }
.side { position: fixed !important; inset: 0 0 0 auto; width: 280px; z-index: 60; transform: translateX(105%); transition: transform .22s ease; height: 100vh; box-shadow: -8px 0 30px rgba(0,0,0,.25); }
.side.open { transform: none; }
.side-bg { position: fixed; inset: 0; background: rgba(8, 20, 30, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
.side-bg.on { opacity: 1; pointer-events: auto; }
@media print { .side-bg { display: none !important; } }
/* ═════ رؤوس الأعمدة: أوضح وأتقل وبشكل أحلى ═════ */
table.grid thead th {
  font-size: 13.5px; font-weight: 900; letter-spacing: .2px; padding: 11px 12px;
  border-bottom: 3px solid var(--brand); border-inline-start: 1px solid rgba(255,255,255,.55);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.04);
}
table.grid thead th.ecol, table.grid thead th:not(.vcol):not(.meta) {
  background: linear-gradient(180deg, #c6e1f2 0%, #9ec8e4 100%); color: #042c42; border-bottom-color: #074d6b;
}
table.grid thead th.vcol { background: linear-gradient(180deg, #e3f8ef 0%, #bfeedb 100%); color: #075a3f; border-bottom-color: #17864f; }
table.grid thead th.meta { background: linear-gradient(180deg, #f1eefa 0%, #e0d9f3 100%); color: #4a3b82; border-bottom-color: #7c6bc4; }
table.grid thead tr:first-child th:first-child { border-top-right-radius: 10px; }
table.grid thead tr:first-child th:last-child { border-top-left-radius: 10px; }
table.grid thead th:hover { filter: brightness(.97); }
:root[data-theme="dark"] table.grid thead th.ecol, :root[data-theme="dark"] table.grid thead th:not(.vcol):not(.meta) { background: linear-gradient(180deg, #17384d 0%, #122c3d 100%); color: #a9dcf2; }
:root[data-theme="dark"] table.grid thead th.vcol { background: linear-gradient(180deg, #164032 0%, #103226 100%); color: #8de6c0; }
:root[data-theme="dark"] table.grid thead th.meta { background: linear-gradient(180deg, #2d2848 0%, #231f3a 100%); color: #cdc3f3; }
:root[data-theme="dark"] table.grid thead th { border-inline-start-color: rgba(255,255,255,.06); }
@media print { table.grid thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* زرار "غدًا" (تسجيل السيتويشن) */
.btn.tomorrow { background: linear-gradient(135deg, #6d28d9, #8b5cf6); border-color: #6d28d9; color: #fff; font-weight: 700; }
.btn.tomorrow:hover { color: #fff; filter: brightness(1.08); }
/* ═════ صف الإجماليات: لون مختلف وأوضح ═════ */
table.grid tfoot td {
  background: linear-gradient(180deg, #fff6dc 0%, #ffe9b0 100%) !important; color: #6b3d00 !important;
  font-size: 15px; font-weight: 900; border-top: 3px solid #e0a33a; padding-top: 10px; padding-bottom: 10px;
}
table.grid tfoot td.n { letter-spacing: .2px; }
table.grid tfoot td.vcol { background: linear-gradient(180deg, #ffe9b0 0%, #ffd97a 100%) !important; color: #5a3200 !important; }
:root[data-theme="dark"] table.grid tfoot td { background: linear-gradient(180deg, #3a2a08 0%, #2e2106 100%) !important; color: #ffd98a !important; border-top-color: #b7791f; }
@media print { table.grid tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* ═════ خانة التاريخ dd/mm/yyyy ═════ */
.dmy { position: relative; display: inline-flex; align-items: center; gap: 4px; }
label.f .dmy { display: flex; width: 100%; }
.dmy .dmy-t { width: 130px; font-variant-numeric: tabular-nums; text-align: center; }
label.f .dmy .dmy-t { width: 100%; flex: 1; }
.dmy .dmy-b { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 8px; cursor: pointer; line-height: 1; }
.dmy .dmy-b:hover { border-color: var(--brand); }
.dmy input.dmy-n { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100% !important; padding: 0; border: 0; }
/* زرار "أمس" (السيتويشن النهائي) */
.btn.yesterday { background: linear-gradient(135deg, #c2410c, #ea7a2f); border-color: #c2410c; color: #fff; font-weight: 700; }
.btn.yesterday:hover { color: #fff; filter: brightness(1.08); }
/* الأرقام بالسالب: أحمر في كل السيستم */
.neg, .neg * { color: #d32f2f !important; }
:root[data-theme="dark"] .neg, :root[data-theme="dark"] .neg * { color: #ff6b6b !important; }
@media print { .neg, .neg * { color: #c62828 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
table.grid tfoot td.neg, table.grid tfoot td.vcol.neg, table.grid tbody td.neg, table.grid td.vcol.neg { color: #d32f2f !important; }
:root[data-theme="dark"] table.grid tfoot td.neg, :root[data-theme="dark"] table.grid td.neg { color: #ff6b6b !important; }
/* ═════ خطوط بين الأعمدة في الجدول زي الهيدر ═════ */
table.grid tbody td, table.grid tfoot td { border-inline-start: 1px solid #dbe5ec; }
table.grid tbody td:first-child, table.grid tfoot td:first-child { border-inline-start: 0; }
:root[data-theme="dark"] table.grid tbody td, :root[data-theme="dark"] table.grid tfoot td { border-inline-start-color: #253644; }
/* ═════ صف الإجماليات: أزرق بحري غامق وخط أبيض (بدل الأصفر) ═════ */
table.grid tfoot td {
  background: linear-gradient(180deg, #0b5a80 0%, #084766 100%) !important; color: #ffffff !important;
  border-top: 3px solid #0fb5a6; border-inline-start-color: rgba(255,255,255,.14);
}
table.grid tfoot td.vcol { background: linear-gradient(180deg, #0c7a6d 0%, #09604f 100%) !important; color: #ffffff !important; }
table.grid tfoot td.neg, table.grid tfoot td.vcol.neg { color: #ffb4ab !important; }
:root[data-theme="dark"] table.grid tfoot td { background: linear-gradient(180deg, #0d3a52 0%, #0a2c3f 100%) !important; color: #e9f6ff !important; }
:root[data-theme="dark"] table.grid tfoot td.vcol { background: linear-gradient(180deg, #0f4a3e 0%, #0b3a31 100%) !important; }
:root[data-theme="dark"] table.grid tfoot td.neg { color: #ffb4ab !important; }
/* ═════ صف الإجماليات: لون فاتح وخط أصغر ═════ */
table.grid tfoot td {
  background: linear-gradient(180deg, #eef7fc 0%, #dbeef8 100%) !important; color: #0a3d5c !important;
  font-size: 13.5px; font-weight: 800; border-top: 2px solid #7fbfdc; border-inline-start-color: #cfe3ee;
  padding-top: 8px; padding-bottom: 8px;
}
table.grid tfoot td.vcol { background: linear-gradient(180deg, #ecfaf3 0%, #d3f2e3 100%) !important; color: #0b6b4c !important; }
table.grid tfoot td.neg, table.grid tfoot td.vcol.neg { color: #d32f2f !important; }
:root[data-theme="dark"] table.grid tfoot td { background: linear-gradient(180deg, #16303f 0%, #132837 100%) !important; color: #cfe9f7 !important; border-top-color: #2f6f8e; }
:root[data-theme="dark"] table.grid tfoot td.vcol { background: linear-gradient(180deg, #153a30 0%, #123128 100%) !important; color: #9ee8c6 !important; }
:root[data-theme="dark"] table.grid tfoot td.neg { color: #ff8a80 !important; }
/* ═════ عمود Total Collect: أحمر ═════ */
table.grid thead th.tc-col, table.inv-t thead th.tc-col { background: linear-gradient(180deg, #fdecea 0%, #f8c9c4 100%) !important; color: #9b1c1c !important; border-bottom-color: #c62828 !important; }
table.grid tbody td.tc-col, table.inv-t tbody td.tc-col { background: #fdf0ef !important; color: #b42318 !important; font-weight: 800; }
table.grid tbody tr:hover td.tc-col { background: #f9dcd9 !important; }
table.grid tfoot td.tc-col, table.inv-t tfoot td.tc-col { background: linear-gradient(180deg, #fdecea 0%, #f7d0cb 100%) !important; color: #9b1c1c !important; }
:root[data-theme="dark"] table.grid thead th.tc-col { background: linear-gradient(180deg, #4a1d1a 0%, #3a1614 100%) !important; color: #ffb4ab !important; }
:root[data-theme="dark"] table.grid tbody td.tc-col { background: #2c1513 !important; color: #ff8a80 !important; }
:root[data-theme="dark"] table.grid tfoot td.tc-col { background: #3a1614 !important; color: #ffb4ab !important; }
@media print { .tc-col { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* ═════ عمود Total Collect: بنفسجي خفيف (بدل الأحمر) ═════ */
table.grid thead th.tc-col, table.inv-t thead th.tc-col { background: linear-gradient(180deg, #f3f0fb 0%, #e3dcf5 100%) !important; color: #5b3fa0 !important; border-bottom-color: #8b6fd6 !important; }
table.grid tbody td.tc-col, table.inv-t tbody td.tc-col { background: #f8f6fd !important; color: #5b3fa0 !important; font-weight: 800; }
table.grid tbody tr:hover td.tc-col { background: #ede8f9 !important; }
table.grid tfoot td.tc-col, table.inv-t tfoot td.tc-col { background: linear-gradient(180deg, #f3f0fb 0%, #e6e0f6 100%) !important; color: #4c338c !important; }
table.grid td.tc-col.neg { color: #d32f2f !important; }
:root[data-theme="dark"] table.grid thead th.tc-col { background: linear-gradient(180deg, #2d2848 0%, #25203d 100%) !important; color: #cdbdf5 !important; }
:root[data-theme="dark"] table.grid tbody td.tc-col { background: #1f1b33 !important; color: #cdbdf5 !important; }
:root[data-theme="dark"] table.grid tfoot td.tc-col { background: #2a2542 !important; color: #d9ccff !important; }
/* ═════ تثبيت أعمدة # والتاريخ والمركب والعميل في السيتويشن ═════ */
table.grid .stk { position: sticky; z-index: 1; }
table.grid thead th.stk { z-index: 4; }
table.grid tfoot td.stk { z-index: 3; }
table.grid tbody td.stk { background-color: var(--panel); }
table.grid .stk-last { box-shadow: -6px 0 8px -6px rgba(10, 28, 43, .28); }
/* ═════ لون السطر حسب الحالة ═════ */
table.grid tbody tr.row-due td { background-color: #fff1f2; }
table.grid tbody tr.row-paid td { background-color: #eefaf2; }
table.grid tbody tr.row-due:hover td { background-color: #fde2e5; }
table.grid tbody tr.row-paid:hover td { background-color: #dcf5e6; }
table.grid tbody tr.row-due td.idx { box-shadow: inset -4px 0 0 #e57373; }
table.grid tbody tr.row-paid td.idx { box-shadow: inset -4px 0 0 #43a047; }
:root[data-theme="dark"] table.grid tbody tr.row-due td { background-color: #2e1a1d; }
:root[data-theme="dark"] table.grid tbody tr.row-paid td { background-color: #16291f; }
.row-legend { display: inline-flex; gap: 10px; align-items: center; font-size: 12.5px; font-weight: 700; }
.row-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 4px; vertical-align: -1px; }
@media print { table.grid .stk { position: static !important; box-shadow: none; } table.grid tbody tr.row-due td, table.grid tbody tr.row-paid td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.pdf-mode table.grid .stk { position: static !important; box-shadow: none; }
table.grid .stk-last { box-shadow: none !important; border-left: 2px solid #8fb8cc !important; }
table.grid thead th.stk-last { border-left: 2px solid #5f9fbd !important; }

/* ===== تقارير المصاريف العامه: كروت لكل اسم ===== */
.exp-grp.xr { border: 0; background: transparent; box-shadow: none; margin-bottom: 22px; }
.xr-h { border-radius: 14px; background: linear-gradient(90deg, #e6f2fa, #f4f9fd); border: 1px solid #d4e6f2; padding: 10px 16px; }
.xr-h > b { font-size: 17px; }
.xr-tot { font-size: 14px; } .xr-tot b { font-size: 18px; }
.xr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 12px; }
.xr-card { background: var(--panel, #fff); border: 1px solid #e3edf4; border-top: 4px solid var(--c); border-radius: 14px; padding: 12px 14px; box-shadow: 0 2px 8px rgba(10, 40, 70, .06); }
.xr-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.xr-rem { font-size: 24px; font-weight: 800; color: var(--c); margin-bottom: 8px; }
.xr-ok { font-size: 16px; }
.xr-lines { border-top: 1px dashed #d8e4ec; padding-top: 6px; font-size: 13px; }
.xr-lines div { display: flex; justify-content: space-between; padding: 2px 0; }
.xr-lines span { color: var(--muted, #6b7c8c); }
:root[data-theme="dark"] .xr-h { background: linear-gradient(90deg, #16303f, #1a2c38); border-color: #28465a; }
:root[data-theme="dark"] .xr-card { border-color: #28465a; }
:root[data-theme="dark"] .xr-lines { border-color: #2e4a5c; }
@media print { .xr-card { break-inside: avoid; box-shadow: none; } .xr-grid { grid-template-columns: repeat(4, 1fr); } }
.pdf-mode .xr-grid { grid-template-columns: repeat(5, 1fr); }

/* ===== أعمدة الإضافة والتعديل أصغر ===== */
table.grid thead th.meta { font-size: 11px !important; padding: 5px 6px !important; white-space: normal !important; width: 1%; min-width: 64px; max-width: 90px; line-height: 1.3; }
table.grid tbody td.meta { font-size: 11px !important; padding: 3px 6px !important; white-space: normal; width: 1%; max-width: 90px; line-height: 1.3; }

/* ===== الخانات اللي ليها اختيارات: سهم جوه الخانة ===== */
input[data-dl] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%230b6a92' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 12px center !important;
  background-size: 12px 8px !important;
  padding-left: 32px !important;
  cursor: pointer;
}
:root[data-theme="dark"] input[data-dl] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2388cdea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* ===== أعمدة أضيق + خط أتقل (عشان يبان تفاصيل أكتر) ===== */
table.grid thead th:not(.meta) { padding: 6px 5px !important; }
table.grid tbody td:not(.meta), table.grid tfoot td:not(.meta) { padding: 5px 5px !important; }
table.grid tbody td:not(.meta) { font-weight: 700; }
table.grid tbody td.n, table.grid tbody td.vcol { font-weight: 800; }
table.grid td.idx { font-weight: 500; }

/* ===== نفس الأعمدة الأضيق والخط الأتقل في جداول الفاتورة وكشف الحساب ===== */
table.inv-t th, table.inv-t td, table.inv-sum th, table.inv-sum td { padding: 5px 5px !important; }
table.inv-t tbody td, table.inv-sum td { font-weight: 700; }

/* ===== زرار ➕ جنب خانة العميل/الاسم ===== */
.btn.qadd { min-width: 38px; padding: 0 10px; font-size: 15px; background: #e8f6ee; border-color: #b9e3c9; color: #1c7c45; }
.btn.qadd:hover { background: #d3efdf; }
:root[data-theme="dark"] .btn.qadd { background: #173427; border-color: #2a5a41; color: #8fe0b1; }

/* ===== الإجماليات: أرقام وأسامي أتقل ===== */
table.grid tfoot td, table.inv-t tfoot td, table.cs-sum tfoot td, table.inv-sum tfoot td { font-weight: 900 !important; }
table.inv-sum td { font-weight: 800; }
.sum-hero span, .sum-top, .sum-top span { font-weight: 800 !important; }
.sum-hero b, .sum-tile > b { font-weight: 900 !important; }
.exp-grp-h, .exp-grp-h b, .xr-tot, .xr-tot b { font-weight: 800; }
.exp-grp-h > b:first-child, .xr-tot b { font-weight: 900; }

/* ===== اختيار خط السيستم ===== */
.font-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.font-opt { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.font-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.font-opt > div { display: flex; flex-direction: column; gap: 2px; }
.font-opt b { font-size: 15px; }
.font-opt .muted { font-size: 12px; }
.font-sample { font-size: 15px; font-weight: 700; margin-top: 4px; }

/* ===== أعمدة الإضافة والتعديل مش بتظهر في الطباعة / PDF / واتساب في السيستم كله ===== */
@media print { table .meta, table th.meta, table td.meta { display: none !important; } }
.pdf-mode table .meta, .pdf-mode table th.meta, .pdf-mode table td.meta { display: none !important; }

/* ===== PDF / طباعة: من غير شريط الأزرار الفاضي ولا خانات زيادة على الشمال ===== */
.pdf-mode #content .card-h:not(:has(h1, h2, h3, h4)) { display: none !important; }
.pdf-mode #content table th.act, .pdf-mode #content table td.act { display: none !important; }
@media print {
  #content .card-h:not(:has(h1, h2, h3, h4)) { display: none !important; }
  table th.act, table td.act { display: none !important; }
}

/* ===== حالة الاتصال في الشريط العلوي ===== */
.net-ic { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; cursor: default; border: 1px solid transparent; }
.net-ic i { font-style: normal; }
.net-ic.on { color: #15803d; background: #e8f7ee; border-color: #bfe8cf; }
.net-ic.off { color: #b45309; background: #fff4e0; border-color: #f6d9a6; }
.net-ic.srv { color: #b42318; background: #fde8e8; border-color: #f5c2c0; animation: netBlink 1.4s infinite; }
@keyframes netBlink { 50% { opacity: .55; } }
:root[data-theme="dark"] .net-ic.on { background: #133322; border-color: #22553a; color: #86e0a8; }
:root[data-theme="dark"] .net-ic.off { background: #3a2a10; border-color: #6b4a16; color: #f7c97a; }
:root[data-theme="dark"] .net-ic.srv { background: #3a1614; border-color: #6b2a26; color: #ffb4ab; }
@media (max-width: 700px) { .net-ic i { display: none; } }
@media print { .net-ic { display: none !important; } }

/* ===== شريط "فيه تحديث جديد" ===== */
.upd-banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 9999; background: #0a4f73; color: #fff; padding: 10px 14px 10px 10px; border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.25); display: flex; align-items: center; gap: 12px; font-weight: 700; }
.upd-banner .icon-btn { color: #fff; }

/* ===== كود التأكيد ===== */
.tf-steps { display: grid; gap: 10px; background: var(--brand-soft); border-radius: 12px; padding: 14px; }
.tf-qr { background: #fff; padding: 8px; border-radius: 10px; justify-self: start; }
.tf-qr svg { display: block; width: 200px; height: 200px; }

/* ===== طلبات الموافقة ===== */
.ap-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 8px; background: var(--panel); }
.ap-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ap-why { color: #8a5a00; background: #fff8e6; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 700; }
:root[data-theme="dark"] .ap-why { background: #3a2a10; color: #f7c97a; }
.ap-det { font-size: 13px; line-height: 1.9; }
.ap-ch s { color: var(--danger); } .ap-ch b { color: var(--ok); }
.ap-kv { display: inline-block; margin-inline-end: 12px; }

/* ===== تقفيل الخزنة ===== */
.cc-done { padding: 12px 16px; margin-bottom: 14px; border-inline-start: 5px solid var(--ok); }
.cc-sum { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 8px; }
.cc-ok { color: var(--ok); font-weight: 800; }
.cc-plus { color: #1d6fb8; font-weight: 800; }
.cc-minus { color: var(--danger); font-weight: 800; }
.cc-in { width: 150px; font-size: 15px; font-weight: 800; text-align: left; }
table.cc-t td, table.cc-t th { white-space: nowrap; }

/* ===== الجهاز مستني موافقة المدير ===== */
.dev-wait { display: flex; align-items: center; gap: 10px; }
.spin { width: 18px; height: 18px; border: 3px solid rgba(10,95,134,.25); border-top-color: var(--brand, #0a5f86); border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast.dev-toast { background: #0a4f73; color: #fff; font-weight: 600; line-height: 1.7; cursor: pointer; }
.toast.dev-toast a.btn { color: #fff; }
table.perms .pd-in { width: 70px; padding: 3px 6px; text-align: center; font-weight: 700; }

/* ===== راس الطباعة (شكل 5: مودرن بخط جانبي) ===== */
.co-head5 { display: flex; align-items: stretch; gap: 16px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #dbe5ec; background: #fff; color: #10222e; }
.co-head5 .ch-bar { width: 8px; border-radius: 8px; background: linear-gradient(#0fb5a6, #0a5f86); flex: none; }
.co-head5 img, .co-head5 .logo { align-self: center; flex: none; }
.co-head5 .ch-main { align-self: center; min-width: 0; }
.co-head5 .ch-main b { font-size: 26px; display: block; line-height: 1.25; color: #10222e; }
.co-head5 .ch-main small { color: #5f7282; font-size: 13px; }
.co-head5 .ch-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.co-head5 .ch-pills span { background: #eef6fb; color: #0a4f73; border-radius: 99px; padding: 2px 10px; font-size: 11.5px; font-weight: 700; }
.co-head5 .ch-rt { margin-inline-start: auto; text-align: left; align-self: center; flex: none; }
.co-head5 .ch-rt div { font-weight: 800; font-size: 16px; color: #0a4f73; }
.co-head5 .ch-rt span { color: #5f7282; font-size: 13px; }
@media print { .co-head5, .co-head5 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.co-head5 .logo { border-radius: 14px; background: linear-gradient(135deg, #0a5f86, #0fb5a6); color: #fff; display: grid; place-items: center; font-weight: 900; }

/* ===== رقم النسخة ===== */
.app-ver { margin: 14px 12px 10px; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.08); color: inherit; opacity: .75; font-size: 11.5px; font-weight: 700; text-align: center; }
.login .app-ver { background: var(--brand-soft); color: var(--muted); opacity: 1; margin: 14px 0 0; }
@media print { .app-ver { display: none !important; } }

/* ===== راس الطباعة (شكل 6: بحري بموجة) ===== */
.co-head6 { position: relative; display: flex; align-items: center; gap: 14px; padding: 6px 0 34px; margin-bottom: 12px; background: #fff; color: #10222e; }
.co-head6 .logo { border-radius: 14px; background: linear-gradient(135deg, #0a5f86, #0fb5a6); color: #fff; display: grid; place-items: center; font-weight: 900; flex: none; }
.co-head6 img { flex: none; }
.co-head6 .ch-main b { font-size: 24px; display: block; color: #0a4f73; line-height: 1.25; }
.co-head6 .ch-main span { color: #5f7282; font-size: 14px; }
.co-head6 .ch-rt { margin-inline-start: auto; text-align: left; font-size: 12.5px; line-height: 1.8; color: #33495a; }
.co-head6 .ch-title { font-weight: 800; font-size: 15px; color: #0a4f73; }
.co-head6 .ch-title small { font-weight: 600; color: #5f7282; font-size: 12.5px; margin-inline-start: 6px; }
.co-head6 .ch-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26px; }
@media print { .co-head6, .co-head6 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ===== الكروت المتدرّجة (شكل 2) ===== */
.gcard { --g1: #0a5f86; --g2: #0fb5a6; display: flex; flex-direction: column; gap: 4px; border-radius: 18px; padding: 16px 18px; color: #fff !important; text-decoration: none !important;
  background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 10px 22px -12px var(--g1); border: 0; min-height: 120px; transition: transform .15s; }
a.gcard:hover { transform: translateY(-2px); }
.gcard .gt { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; opacity: .97; }
.gcard .gt b { background: rgba(255,255,255,.22); border-radius: 8px; padding: 0 9px; font-size: 13px; }
.gcard .gv { font-size: 30px; font-weight: 900; line-height: 1.2; margin: 6px 0 4px; direction: ltr; text-align: right; }
.gcard .gv small { font-size: 13px; font-weight: 800; background: rgba(0,0,0,.18); border-radius: 6px; padding: 1px 7px; margin-inline-start: 6px; }
.gcard .gl { display: grid; gap: 2px; font-size: 12.5px; }
.gcard .gl div { display: flex; justify-content: space-between; opacity: .95; }
.gcard .gs { font-size: 12px; font-weight: 600; opacity: .95; line-height: 1.7; }
.gcard .gf { font-size: 12px; font-weight: 800; opacity: .85; margin-top: 2px; }
.gcard *, .gcard .neg, .gcard [class*="cur-"], .gcard [style*="color"] { color: #fff !important; }
.gcard a { text-decoration: underline; }
.g-cur-EGP, .g-ok { --g1: #15803d; --g2: #10b981; }
.g-cur-USD { --g1: #1d4ed8; --g2: #60a5fa; }
.g-cur-EUR { --g1: #7e22ce; --g2: #c084fc; }
.g-cur-GBP { --g1: #c2410c; --g2: #fb923c; }
.g-bad { --g1: #b42318; --g2: #f87171; }
.g-warn { --g1: #b45309; --g2: #f59e0b; }
.g-brand { --g1: #0a5f86; --g2: #0fb5a6; }

/* نفس الشكل لكروت الإجماليات في التقارير */
.sum-tile { --g1: #0a5f86; --g2: #0fb5a6; background: linear-gradient(135deg, var(--g1), var(--g2)) !important; color: #fff !important; border: 0 !important; border-radius: 18px !important; box-shadow: 0 10px 22px -12px var(--g1) !important; }
.sum-tile.cur-b-EGP { --g1: #15803d; --g2: #10b981; }
.sum-tile.cur-b-USD { --g1: #1d4ed8; --g2: #60a5fa; }
.sum-tile.cur-b-EUR { --g1: #7e22ce; --g2: #c084fc; }
.sum-tile.cur-b-GBP { --g1: #c2410c; --g2: #fb923c; }
.sum-tile[style*="--danger"] { --g1: #b42318; --g2: #f87171; }
.sum-tile[style*="--ok"] { --g1: #15803d; --g2: #10b981; }
.sum-tile *, .sum-tile > b, .sum-tile .neg, .sum-tile [style*="color"] { color: #fff !important; }
.sum-tile .sum-top em { background: rgba(255,255,255,.22) !important; }
.sum-tile > small { opacity: .9; }
@media print { .gcard, .sum-tile { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.sum-hero .neg, .sum-hero b, .sum-hero b * { color: #fff !important; }

/* رقم + رمز العملة يفضلوا لازقين في بعض وبالترتيب الصح جوه النص العربي */
.cm{unicode-bidi:isolate;direction:ltr;display:inline-block;white-space:nowrap}

/* رؤوس الأعمدة أقصر شوية — في كل الجداول */
table.grid thead th:not(.meta) { padding: 3px 5px !important; line-height: 1.15; font-size: 12px !important; }

/* السيتويشن: أعمدة بتختفي في الطباعة و PDF والواتساب */
.print-lbl { display: none; }
@media print { table.grid .px { display: none !important; } table.grid .print-lbl { display: inline !important; } }
.pdf-mode #content table.grid .px { display: none !important; }
.pdf-mode #content table.grid .print-lbl { display: inline !important; }

/* الطباعة و PDF والواتساب: الجداول من الشمال لليمين (عكس الشاشة) */
@media print { table.grid, table.inv-t { direction: ltr; } }
.pdf-mode #content table.grid, .pdf-mode #content table.inv-t { direction: ltr; }

/* كشف حساب العملاء: الجداول من الشمال لليمين */
.cs-ltr table.grid, .cs-ltr table.inv-t, .cs-ltr .tbl-wrap, .cs-ltr .inv-scroll { direction: ltr; }

/* الشريط الجانبي: كل قسم قايمة منسدلة */
.nav-sec { margin: 4px 0; border-radius: 10px; }
.nav-sec > summary { list-style: none; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 800; color: #9fe3da; }
.nav-sec > summary::-webkit-details-marker { display: none; }
.nav-sec > summary::after { content: '‹'; margin-inline-start: auto; font-size: 18px; line-height: 1; transition: transform .2s; opacity: .8; }
.nav-sec[open] > summary::after { transform: rotate(-90deg); }
.nav-sec > summary:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-sec[open] > summary { color: #fff; background: rgba(255,255,255,.05); }
.nav-sec .nav-items { padding: 2px 0 6px; padding-inline-start: 8px; border-inline-start: 2px solid rgba(127,211,201,.18); margin-inline-start: 14px; }
.nav-sec .nav-items a { font-size: 14px; }

/* 📱 تسجيل سريع (موبايل) */
.m-wrap { max-width: 640px; margin: 0 auto; display: grid; gap: 12px; }
.m-tabs { display: flex; gap: 6px; background: var(--panel); padding: 5px; border-radius: 14px; border: 1px solid var(--line); }
.m-tab { flex: 1; border: 0; background: transparent; padding: 11px 6px; border-radius: 10px; font: inherit; font-weight: 800; font-size: 15px; color: var(--muted); cursor: pointer; }
.m-tab.on { background: var(--brand); color: #fff; }
.m-date { display: flex; gap: 6px; align-items: center; }
.m-date input { flex: 1; font-size: 16px; padding: 10px; }
.m-day { text-align: center; font-weight: 700; margin-top: -4px; }
.m-add { width: 100%; padding: 16px; font-size: 18px; border-radius: 14px; }
.m-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.m-sum b { display: block; font-size: 17px; } .m-sum small { color: var(--muted); font-size: 11.5px; }
.m-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; box-shadow: 0 2px 8px rgba(15,23,42,.04); border-inline-start: 5px solid var(--brand); }
.m-top { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.m-boat { background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 2px 10px; font-weight: 800; font-size: 13px; }
.m-mid, .m-cnt { font-size: 14px; } .m-money { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; font-weight: 700; }
.m-act { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 700px) {
  .modal-bg { padding: 0; place-items: stretch; }
  .modal { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-grid input, .form-grid select, .form-grid textarea { font-size: 16px; }
  .modal-f { position: sticky; bottom: 0; background: var(--panel); flex-wrap: wrap; }
  .modal-f .btn { flex: 1; padding: 12px; font-size: 15px; }
  .content { padding: 10px; }
}

/* فورم الإضافة: عنوان كل قسم بيفضل ثابت فوق وانت بتنزل */
.modal-b .form-sec { position: sticky; top: -18px; z-index: 3; box-shadow: 0 2px 0 var(--panel), 0 -8px 0 var(--panel); }

/* صف العناوين ثابت فوق في كل الجداول والتقارير (حتى اللي كانت من غير حد للطول) */
@media screen {
  .tbl-wrap[style*="max-height:none"], .tbl-wrap[style*="max-height: none"] { max-height: calc(100vh - 170px) !important; overflow: auto !important; }
  body:not(.pdf-mode) table.grid thead th { position: sticky; top: 0; z-index: 2; }
}

/* شريط الأدوات والفلاتر أصغر — عشان الجدول ياخد معظم الشاشة */
@media screen {
  #content .card-h { padding: 6px 10px; gap: 6px; }
  #content .card-h .toolbar { gap: 5px; }
  #content .card-h .toolbar .btn { padding: 4px 10px; font-size: 12.5px; min-height: 0; line-height: 1.5; border-radius: 8px; }
  #content .card-h .toolbar .btn.sm { padding: 3px 8px; font-size: 12px; }
  #content .card-h .toolbar input, #content .card-h .toolbar select { padding: 4px 8px; font-size: 13px; min-height: 0; height: 32px; }
  #content .card-h .toolbar input.search { width: 200px; }
  #content .card-h .toolbar input[type="date"] { width: 140px; }
  #content .card-h .toolbar b { font-size: 13px; }
  #content .filters { padding: 4px 10px; gap: 6px 10px; align-items: center; }
  #content .filters .fl { flex-direction: row; align-items: center; gap: 4px; font-size: 11.5px; }
  #content .filters select { width: 130px; padding: 2px 6px; height: 28px; font-size: 12.5px; }
  #content .filters .btn { padding: 2px 8px; font-size: 12px; }
  .tbl-wrap { max-height: calc(100vh - 185px); }
}

/* كل الجداول: أصغر عشان يبان أكتر في الشاشة */
@media screen {
  table.grid { font-size: 12px; }
  table.grid th, table.grid td { padding: 3px 6px; }
  table.grid td.act .btn, table.grid td .btn.sm { padding: 1px 6px; font-size: 11px; }
  table.grid input[type="checkbox"] { width: 14px; height: 14px; }
}

/* الشريط اللي فوق أصغر بالربع + مسافات الصفحة أقل شوية */
@media screen {
  .topbar { padding: 8px 20px !important; }
  .topbar h1 { font-size: 17px !important; }
  .content { padding: 14px 18px 30px !important; }
  .tbl-wrap { max-height: calc(100vh - 170px); }
}

/* عمود التعديل والحذف أصغر */
@media screen {
  table.grid td.act, table.grid th.act { padding: 1px 3px !important; width: 1%; white-space: nowrap; }
  table.grid td.act .icon-btn { padding: 0 2px; font-size: 11px; min-width: 0; width: auto; height: auto; line-height: 1.3; border: 0; background: none; }
}

/* العناوين الإنجليزي (زي 1 Intro و Col $) بتتكتب من الشمال لليمين */
table.grid th, table.inv-t th, label.f > span:first-child, .filters .fl > span { unicode-bidi: plaintext; }

/* كشف الحساب: كروت الأعداد */
.cs-cnt { display: grid; grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 6px; margin: 10px 0; }
.cs-cnt > div { border: 1px solid #cfd9e1; border-radius: 8px; padding: 5px 8px; text-align: center; background: #f7fafc; }
.cs-cnt span { display: block; font-size: 11px; color: #5b6b78; unicode-bidi: plaintext; }
.cs-cnt b { font-size: 15px; }
table.inv-t.cs-c th, table.inv-t.cs-c td { text-align: center; }
table.inv-t.cs-c td:nth-child(2)[style] { text-align: right; }

/* ——— واجهة الدخول (بحر + فقاعات + أسباب) ——— */
.lp { position: fixed; inset: 0; overflow: hidden; color: #eaf6fb; background: linear-gradient(180deg, #0a6c95 0%, #084e6d 38%, #062536 100%); }
.lp-rays { position: absolute; inset: 0; background: repeating-linear-gradient(100deg, #ffffff0a 0 40px, transparent 40px 120px); -webkit-mask: linear-gradient(#000, transparent 60%); mask: linear-gradient(#000, transparent 60%); pointer-events: none; }
.lp-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 140px; opacity: .35; pointer-events: none; }
.lp-bub { position: absolute; bottom: -60px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffffffaa, #ffffff22 60%, transparent 70%); animation: lpUp linear infinite; opacity: .55; pointer-events: none; }
@keyframes lpUp { to { transform: translateY(-115vh) translateX(30px); } }
.lp-page { position: relative; z-index: 2; height: 100%; display: grid; grid-template-columns: 400px 1fr; align-items: center; gap: 40px; padding: 0 6vw; overflow: auto; }
.lp .lp-login { width: auto; max-width: none; margin: 0; border-radius: 22px; padding: 30px 28px; box-shadow: 0 30px 60px #0008; color: var(--ink); }
.lp-lock { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.lp-tag { display: inline-block; background: #ffffff1f; border: 1px solid #ffffff33; padding: 5px 14px; border-radius: 20px; font-size: 13px; margin-bottom: 14px; }
.lp-hero h2 { font-size: 40px; line-height: 1.25; margin: 0 0 10px; color: #fff; }
.lp-hero h2 b { background: linear-gradient(90deg, #7ff0e4, #fff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { font-size: 16px; opacity: .85; margin: 0 0 24px; max-width: 620px; line-height: 1.7; }
.lp-why { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 760px; }
.lp-why div { background: #ffffff14; border: 1px solid #ffffff26; border-radius: 16px; padding: 14px 16px; transition: transform .2s; }
.lp-why div:hover { transform: translateY(-3px); }
.lp-why i { font-style: normal; font-size: 22px; } .lp-why b { display: block; margin: 6px 0 2px; font-size: 15px; color: #fff; } .lp-why span { font-size: 13px; opacity: .8; line-height: 1.6; }
.lp-chips { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; max-width: 680px; } .lp-chips span { font-size: 12px; background: #0fb5a633; border: 1px solid #0fb5a666; padding: 4px 11px; border-radius: 20px; }
.lp-powered { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; z-index: 3; font-size: 13px; letter-spacing: .5px; color: #d6eef6; direction: ltr; }
.lp-powered b { color: #7ff0e4; }
@media (max-width: 1000px) { .lp-page { grid-template-columns: 1fr; padding: 24px 16px 60px; align-items: start; } .lp-hero h2 { font-size: 28px; } .lp-why { grid-template-columns: 1fr; } }
/* سمك واجهة الدخول */
.lp-fish { position: absolute; z-index: 1; pointer-events: none; animation: lpSwim linear infinite; }
.lp-fish svg { display: block; animation: lpBob 2.4s ease-in-out infinite; }
.lp-fish .tail { transform-origin: 22% 50%; animation: lpWag .45s ease-in-out infinite alternate; }
.lp-fish.rev { animation-name: lpSwimR; } .lp-fish.rev svg { animation-name: lpBobR; }
@keyframes lpSwim { from { left: -140px; } to { left: calc(100% + 140px); } }
@keyframes lpSwimR { from { left: calc(100% + 140px); } to { left: -140px; } }
@keyframes lpBob { 0%, 100% { transform: none; } 50% { transform: translateY(-10px); } }
@keyframes lpBobR { 0%, 100% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-10px); } }
@keyframes lpWag { from { transform: scaleY(1) rotate(-12deg); } to { transform: scaleY(.8) rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .lp-fish, .lp-bub { display: none; } }
/* الموبايل: Powered by ثابت تحت بخلفية عشان ما يركبش على الكلام */
@media (max-width: 1000px) { .lp-powered { position: fixed; bottom: 0; padding: 7px 0; background: #062536e6; } }
/* الموبايل: الأقسام ماتتمطش بعرض الجدول + خانات أعمار الديون تنزل سطرين */
.dash-grid > * { min-width: 0; }
@media (max-width: 600px) { .aging-bar { flex-wrap: wrap; } .aging-bar .ag { min-width: calc(50% - 3px); flex: 1 1 calc(50% - 3px) !important; } }
