/* ============================================================
   تحصيل برو — ألوان الشعار: خلفية تفاحية، قائمة خضراء، لمسات ذهبية فاتحة
   ============================================================ */
:root {
  --bg: #eef7e2;
  --panel: #fffefb;
  --card: #ffffff;
  --card-2: #f4f9ec;
  --ink: #1f2a17;
  --muted: #66755a;
  --soft: #3f4d33;
  --line: rgba(60,100,30,.14);
  --line-2: rgba(60,100,30,.30);
  --tint: rgba(60,120,30,.07);
  --green-900: #013a0a; --green: #02761f; --green-2: #014d0f; --gold: #f7dc7a; --gold-2: #f2d36b; --gold-ink: #8a5f0a;
  --accent: #02761f;
  --accent-ink: #f7dc7a;
  --accent-soft: rgba(2,118,31,.14);
  --teal: #2dd4bf; --yellow: #fde047; --pink: #f472b6; --violet: #a78bfa; --orange: #fb923c; --blue: #60a5fa; --red: #fb7185; --cyan: #22d3ee;
  --ok: #0f766e; --ok-soft: rgba(45,212,191,.18);
  --warn: #a16207; --warn-soft: rgba(234,179,8,.16);
  --bad: #e11d48; --bad-soft: rgba(251,113,133,.16);
  --accent-text: #02761f;
  --radius: 18px;
}
/* كل الأقسام بنفس ألوان الشعار */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--bg);
  background-image: radial-gradient(rgba(2,118,31,.10) 1px, transparent 1.4px); background-size: 24px 24px;
  font-family: "Alexandria", "Segoe UI", Tahoma, sans-serif; font-size: 15px; line-height: 1.65;
}
a { color: #02761f; text-decoration: none; }
a:hover { color: #014d0f; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; direction: ltr; text-align: left; unicode-bidi: plaintext; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- الهيكل: قائمة جانبية + محتوى ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 250px; flex: none; background: var(--panel); border-left: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .logo3d { display: block; width: 40px; height: 40px; perspective: 700px; flex: none; }
.brand .cube { display: block; width: 40px; height: 40px; position: relative; transform-style: preserve-3d; animation: cubeSpin 16s linear infinite; }
.brand .cube i { position: absolute; inset: 0; border-radius: 9px; }
.brand .cube i:nth-child(1) { background: var(--cyan); transform: translateZ(20px); }
.brand .cube i:nth-child(2) { background: var(--violet); transform: rotateY(90deg) translateZ(20px); }
.brand .cube i:nth-child(3) { background: var(--yellow); transform: rotateY(180deg) translateZ(20px); }
.brand .cube i:nth-child(4) { background: var(--pink); transform: rotateY(-90deg) translateZ(20px); }
.brand .cube i:nth-child(5) { background: var(--teal); transform: rotateX(90deg) translateZ(20px); }
.brand .cube i:nth-child(6) { background: var(--blue); transform: rotateX(-90deg) translateZ(20px); }
@keyframes cubeSpin { from { transform: rotateX(-24deg) rotateY(0); } to { transform: rotateX(-24deg) rotateY(360deg); } }
.brand b { font-size: 18px; font-weight: 800; display: block; line-height: 1.2; }
.brand small { font-size: 11px; color: var(--muted); }

.nav-item {
  display: flex; align-items: center; gap: 12px; color: var(--soft); border-radius: 14px; padding: 9px 10px; font-size: 15px; min-height: 44px;
}
.nav-item:hover { background: var(--tint); color: var(--ink); }
.nav-item.on { background: rgba(150,110,40,.14); color: var(--ink); font-weight: 600; }
.nav-item .ic {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--c, var(--accent)); box-shadow: 0 6px 14px color-mix(in srgb, var(--c, var(--accent)) 35%, transparent);
  transition: transform .2s;
}
.nav-item.on .ic, .nav-item:hover .ic { transform: rotate(-10deg) scale(1.07); }
.nav-item .ic svg { width: 16px; height: 16px; stroke: #0b1020; }
.side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.side .me .av { width: 36px; height: 36px; border-radius: 11px; background: var(--yellow); color: #3a2d00; font-weight: 800; display: grid; place-items: center; flex: none; }
.side .me .who { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.side .me .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me button { background: transparent; border: 1px solid var(--line-2); color: var(--soft); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer; }

.content { flex: 1; min-width: 0; }
main { max-width: 1200px; margin: 0 auto; padding: 26px 28px 70px; }
.topbar { display: none; }
.bottom-nav { display: none; }

h1 { font-size: 26px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.3px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- بطاقات وأرقام ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 18px; margin-bottom: 18px; }
a.card { display: block; color: var(--ink); transition: transform .2s, border-color .2s; }
a.card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* بطاقة رقم بارزة بعمق (مكعب): ظل مُزاح بلون أغمق يعطي جانب المكعب */
.stat {
  --c: var(--accent); position: relative; background: var(--card); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 18px; padding: 16px; margin: 0 0 10px 10px;
  box-shadow: -10px 10px 0 color-mix(in srgb, var(--c) 75%, #3b2a10), 0 20px 30px rgba(90,60,20,.16); transition: transform .25s, box-shadow .25s;
}
.stat:hover { transform: translate(3px,-4px); box-shadow: -13px 14px 0 color-mix(in srgb, var(--c) 75%, #3b2a10), 0 26px 36px rgba(90,60,20,.2); }
.stat .l { color: var(--soft); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat .l::after { content: ""; width: 26px; height: 26px; border-radius: 8px; background: var(--c); flex: none; }
.stat .l:has(.si)::after { display: none; }
.stat .si, .alert-row .dot { display: grid; place-items: center; stroke: #0b0f1f; }
.stat .si { width: 30px; height: 30px; border-radius: 9px; background: var(--c); flex: none; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 6px; color: color-mix(in srgb, var(--c) 55%, #2e2618); font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: 12px; }
.stat.ok { --c: var(--teal); } .stat.bad { --c: var(--red); } .stat.warn { --c: var(--yellow); } .stat.vi { --c: var(--violet); } .stat.or { --c: var(--orange); } .stat.bl { --c: var(--blue); }

/* ---------- جداول ---------- */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--tint); }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--tint); }
tfoot td { font-weight: 700; background: var(--tint); }
td.wrap { white-space: normal; min-width: 180px; }
tr.muted td { color: var(--muted); }
tr.struck td { text-decoration: line-through; color: var(--muted); }

/* ---------- شارات الحالة ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(120,90,40,.10); color: var(--soft); }
.st-active { background: rgba(96,165,250,.18); color: #1d4ed8; }
.st-completed { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: rgba(120,90,40,.08); color: var(--muted); }
.st-defaulted { background: var(--warn-soft); color: var(--warn); }
.st-legal { background: var(--bad-soft); color: var(--bad); }
.st-written_off { background: #e7dcc6; color: #574a35; }
.pill-bad { color: var(--bad); font-weight: 600; }
.plus { color: var(--ok); } .minus { color: var(--bad); }

/* ---------- نماذج ---------- */
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: #fffdf8; color: var(--ink); min-height: 44px;
}
input::placeholder, textarea::placeholder { color: #a99a80; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[readonly] { opacity: .8; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
input[type=date], input[type=month] { color-scheme: light; }
select { color-scheme: light; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; padding: 10px 18px; min-height: 44px; border-radius: 14px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 -3px 0 rgba(0,0,0,.14); transition: transform .15s, filter .15s;
}
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.light { background: var(--card); color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.light:hover { background: var(--card-2); color: var(--ink); }
.btn.danger { background: #e11d48; border-color: #e11d48; color: #fff; box-shadow: 0 8px 18px rgba(225,29,72,.22); }
.btn.sm { padding: 5px 11px; font-size: 13px; min-height: 34px; border-radius: 10px; box-shadow: none; }
.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 14px; }

.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; font-weight: 500; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(45,212,191,.3); }
.flash.error { background: var(--bad-soft); color: #be123c; border-color: rgba(251,113,133,.35); }
.note { background: var(--warn-soft); color: #854d0e; border: 1px solid rgba(234,179,8,.35); border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 14px; }
dl.kv dd { margin: 0; font-weight: 500; }
details summary { cursor: pointer; font-weight: 700; color: var(--accent-text); }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.pager span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.calc { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 16px; padding: 14px 16px; margin: 10px 0; }
.calc .row > div { flex: 1 1 120px; }
.calc b { display: block; font-size: 20px; }
.split { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--soft); }

/* إظهار كلمة المرور */
.pw-wrap { position: relative; display: block; width: 100%; }
td .pw-wrap, .row .pw-wrap { display: inline-block; width: auto; }
.pw-wrap input { padding-left: 44px !important; }
.pw-eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; line-height: 0; }
.pw-eye:hover { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- صفحة الدخول ---------- */
.login { max-width: 400px; margin: 10vh auto; padding: 0 16px; }
.login .card { padding: 28px; box-shadow: 0 24px 50px rgba(90,60,20,.18); }
.login .brand { justify-content: center; padding-bottom: 22px; }
.login.login2 { max-width: 820px; margin-top: 7vh; }
.login-boxes { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.login-box { --accent: var(--c); --accent-text: color-mix(in srgb, var(--c) 60%, #2e2618); --accent-soft: color-mix(in srgb, var(--c) 18%, transparent); border-top: 5px solid var(--c); margin: 0; }
.login-box .btn { color: #1b1530; }
.lb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.lb-head h1 { font-size: 19px; margin: 0; }
.lb-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--c); display: grid; place-items: center; stroke: #1b1530; flex: none; }
@media (max-width: 700px) { .login-boxes { grid-template-columns: 1fr; } }

/* ---------- المربعات التي تنقلب ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 26px; margin-top: 34px; perspective: 1600px; }
.flip { height: 350px; position: relative; cursor: pointer; display: block; color: var(--ink); }
.flip:hover { color: var(--ink); }
.flip .inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.flip:hover .inner, .flip.open .inner { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 28px; border: 1px solid var(--edge); box-shadow: 0 22px 44px rgba(90,60,20,.18); padding: 24px; display: flex; flex-direction: column; }
.flip .front { background: var(--card); }
.flip .back { background: var(--backbg); transform: rotateY(180deg); gap: 14px; }
.flip .art { flex: 1; display: grid; place-items: center; animation: bob 5s ease-in-out infinite; min-height: 0; }
.flip .art img { width: 100%; max-width: 300px; height: auto; max-height: 200px; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(1,58,10,.18)); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.flip h2 { font-size: 25px; font-weight: 800; margin: 0; }
.flip .tag { font-size: 13px; color: var(--muted); }
.flip .go { width: 46px; height: 46px; border-radius: 14px; background: var(--c); display: grid; place-items: center; box-shadow: 0 10px 20px color-mix(in srgb, var(--c) 35%, transparent); flex: none; }
.flip .stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: auto; }
.flip .stats div { background: rgba(255,255,255,.6); border-radius: 14px; padding: 10px 12px; }
.flip .stats b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.flip .stats span { font-size: 12px; color: var(--muted); }
.flip .enter { text-align: center; border-radius: 14px; padding: 12px; font-weight: 700; background: var(--c); color: #0b1020; }

/* ---------- القرص المجسم ---------- */
.donut3d { width: 190px; height: 150px; position: relative; perspective: 600px; flex: none; }
.donut3d .tilt { position: absolute; inset: 0; transform: rotateX(58deg); transform-style: preserve-3d; }
.donut3d .layer { position: absolute; left: 5px; top: -15px; width: 180px; height: 180px; border-radius: 50%; }
.donut3d .hole { position: absolute; left: 55px; top: 35px; width: 80px; height: 80px; border-radius: 50%; background: var(--panel); transform: translateZ(16px); }
.legend { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-left: 8px; vertical-align: -1px; }

/* قائمة "يحتاج انتباهك" */
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; color: var(--ink); }
.alert-row:hover { color: var(--ink); border-color: var(--line-2); }
.alert-row .dot { width: 38px; height: 38px; border-radius: 12px; flex: none; background: var(--c); box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 35%, transparent); }
.alert-row .t { flex: 1; min-width: 0; } .alert-row .t b { display: block; font-size: 15px; } .alert-row .t span { font-size: 12px; color: var(--muted); }
.alert-row .cta { font-size: 13px; border-radius: 10px; padding: 8px 12px; background: var(--tint); white-space: nowrap; }

/* ---------- صفحة الموظف (جوال) ---------- */
.wallet { position: relative; padding: 0 0 12px 12px; margin-bottom: 22px; }
.wallet::before { content: ""; position: absolute; top: 12px; right: 12px; left: 0; bottom: 0; border-radius: 22px; background: #0f766e; }
.wallet .box { position: relative; border-radius: 22px; background: var(--teal); color: #062a26; padding: 18px 20px; box-shadow: 0 16px 28px rgba(15,118,110,.25); }
.wallet .box .v { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wallet .box .s { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; font-weight: 500; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 24px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; color: var(--ink); text-align: center; }
.quick .q { width: 58px; height: 58px; border-radius: 18px; background: var(--c); display: grid; place-items: center; box-shadow: 0 10px 18px color-mix(in srgb, var(--c) 30%, transparent), inset 0 -4px 0 rgba(0,0,0,.18); transition: transform .15s; }
.quick a:hover .q { transform: translateY(-3px) rotate(-6deg); }
.quick .q svg { width: 24px; height: 24px; stroke: #0b1020; }
.due-list { display: flex; flex-direction: column; gap: 10px; }
.due { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.due .bar { width: 8px; align-self: stretch; border-radius: 6px; background: var(--c); }
.due .t { flex: 1; min-width: 0; } .due .t b { display: block; font-size: 15px; } .due .t span { font-size: 12px; color: var(--muted); }

/* نافذة السداد السريع */
.sheet-bg { position: fixed; inset: 0; background: rgba(46,38,24,.45); z-index: 60; display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--card); border-radius: 26px 26px 0 0; padding: 18px 18px 26px; box-shadow: 0 -16px 36px rgba(90,60,20,.25); transform: translateY(105%); transition: transform .28s ease-out; max-width: 560px; margin: 0 auto; }
.sheet { visibility: hidden; }
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet-bg.open { display: block; }
.sheet .grip { width: 44px; height: 5px; border-radius: 9px; background: rgba(46,38,24,.2); margin: 0 auto 14px; }
.sheet .amt { font-size: 26px; font-weight: 800; text-align: center; }

/* ---------- سند القبض: يُطبع أبيض ---------- */
.receipt { max-width: 640px; margin: 0 auto; background: #fff; color: #111; border-radius: 18px; padding: 28px; box-shadow: 0 12px 30px rgba(90,60,20,.14); border: 1px solid var(--line); }
.receipt .sub, .receipt dl.kv dt { color: #555; }
.receipt .rh { display: flex; justify-content: space-between; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 16px; }
.receipt .amount { font-size: 26px; font-weight: 800; text-align: center; border: 2px dashed #ccc; border-radius: 10px; padding: 10px; margin: 14px 0; }
.receipt .sign { display: flex; justify-content: space-between; margin-top: 40px; color: #555; }

/* ---------- الجوال ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; top: 0; right: 0; bottom: 0; transform: translateX(105%); transition: transform .25s; box-shadow: -20px 0 40px rgba(90,60,20,.25); width: 270px; }
  .side.open { transform: translateX(0); }
  .side-bg { position: fixed; inset: 0; background: rgba(46,38,24,.4); z-index: 25; display: none; }
  .side-bg.open { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; } .topbar .brand .logo3d, .topbar .brand .cube { width: 32px; height: 32px; } .topbar .brand b { font-size: 16px; }
  .topbar button { background: transparent; border: 1px solid var(--line-2); color: var(--ink); border-radius: 12px; padding: 8px 12px; font: inherit; min-height: 40px; }
  main { padding: 18px 16px 110px; }
  .bottom-nav { display: flex; position: fixed; left: 10px; right: 10px; bottom: 10px; height: 64px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-2); box-shadow: 0 10px 26px rgba(90,60,20,.2); z-index: 20; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; }
  .bottom-nav a .ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; }
  .bottom-nav a .ic svg { width: 18px; height: 18px; stroke: currentColor; }
  .bottom-nav a.on { color: var(--accent-text); } .bottom-nav a.on .ic { background: var(--accent-soft); }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3, .g2 { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .stat .v { font-size: 21px; }
  .flip { height: 300px; }
}
@media print {
  .side, .topbar, .bottom-nav, .noprint, .flash, .sheet, .sheet-bg { display: none !important; }
  body { background: #fff !important; color: #000; }
  main { padding: 0; max-width: none; }
  .card, .tw { border: 0; background: #fff; color: #000; }
  th, td { color: #000; border-color: #ccc; }
  .receipt { box-shadow: none; }
}

/* ============================================================
   ألوان الشعار (أخضر + ذهبي فاتح) — تطبَّق فوق ما سبق
   ============================================================ */
.side { background: var(--green-900); border-left: 3px solid var(--gold); color: #e8f0e2; }
.side .brand, .side .brand:hover { color: var(--gold); } .side .brand small { color: #b9cdb0; }
.nav-item { color: #dfe9d8; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: rgba(247,220,122,.18); color: var(--gold); box-shadow: inset -3px 0 0 var(--gold); }
.nav-item .ic { background: #22c55e; box-shadow: none; }
.nav-item.on .ic { background: var(--gold); }
.nav-item .ic svg { stroke: #013a0a; }
.side .sep { background: rgba(247,220,122,.25); }
.side .me { background: rgba(255,255,255,.06); border-color: rgba(247,220,122,.25); color: #e8f0e2; }
.side .me .who b, .side .me a.who { color: #fff !important; } .side .me .who span { color: #b9cdb0 !important; }
.side .me .av { background: var(--gold); color: #3d2c00; }
.side .me button { color: var(--gold); border-color: rgba(247,220,122,.45); }
main h1 { display: inline-block; border-bottom: 3px solid var(--gold-2); padding-bottom: 4px; color: var(--green-900); }
.card, .tw { border-color: #e2e9cf; }
.stat { background: #fff; border: 1px solid #e9dc9a; border-top: 4px solid var(--gold-2); box-shadow: -8px 8px 0 color-mix(in srgb, var(--c) 55%, #013a0a), 0 14px 24px rgba(1,58,10,.10); }
.stat:hover { box-shadow: -11px 12px 0 color-mix(in srgb, var(--c) 55%, #013a0a), 0 18px 28px rgba(1,58,10,.14); }
.stat.ok { --c: #22c55e; }
.btn { background: var(--green); border: 1.5px solid var(--gold); color: var(--gold); font-family: "Cairo", "Alexandria", Tahoma, sans-serif; font-weight: 900; letter-spacing: 0; box-shadow: 0 6px 14px rgba(2,118,31,.22), inset 0 -3px 0 rgba(0,0,0,.18); }
.btn:hover { color: var(--gold); filter: brightness(1.1); }
.btn.light { background: #fff; color: var(--green); border: 1.5px solid var(--green); box-shadow: none; }
.btn.light:hover { background: #f4f9ec; color: var(--green-2); }
.btn.danger { background: #e11d48; border-color: #e11d48; color: #fff; }
.pager span { color: var(--gold); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(2,118,31,.18); border-color: var(--green); }
.calc { background: #f4f9ec; border-color: rgba(2,118,31,.3); }
.wallet::before { background: var(--green-900); }
.wallet .box { background: var(--green); color: var(--gold); border: 1.5px solid var(--gold); box-shadow: 0 14px 26px rgba(1,58,10,.25); }
.quick .q svg { stroke: #013a0a; }
.login-box { --accent: var(--green); --accent-text: var(--green); border-top: 5px solid var(--gold-2); }
.login-box .btn { color: var(--gold); }
.lb-ic { background: var(--green); stroke: var(--gold); }
.flip .go { background: var(--green); box-shadow: 0 8px 16px rgba(2,118,31,.3); }
.flip .go svg { stroke: var(--gold) !important; }
.flip .enter { background: var(--green); color: var(--gold); border: 1.5px solid var(--gold); }
@media (max-width: 900px) {
  .topbar { background: var(--green-900); border-bottom: 3px solid var(--gold); }
  .topbar .brand, .topbar .brand:hover { color: var(--gold); } .topbar .brand small { color: #b9cdb0; }
  .topbar button { color: var(--gold); border-color: rgba(247,220,122,.5); }
  .bottom-nav { background: var(--green-900); border-color: var(--gold); }
  .bottom-nav a { color: #cfdcc7; }
  .bottom-nav a.on { color: var(--gold); } .bottom-nav a.on .ic { background: rgba(247,220,122,.2); }
}
@media print { main h1 { border: 0; } }

/* ---------- صفحة البوابة (الصفحة الأولى قبل الدخول) ---------- */
.portal { max-width: 1160px; margin: 0 auto; padding: 10px 0 30px; display: flex; flex-direction: column; }
.portal-head { text-align: center; margin-top: 18px; }
.portal-head h1 { font-size: 40px; }
.portal-tiles { margin-top: 28px; }
.portal .flip { cursor: pointer; }
.portal .flip.picked .face { border: 2px solid var(--gold-2); box-shadow: 0 0 0 4px rgba(247,220,122,.35), 0 22px 44px rgba(1,58,10,.16); }
.portal .flip .go { stroke: var(--gold); }
.portal-login { max-width: 820px; width: 100%; margin: 34px auto 0; }
@media (max-width: 900px) {
  .portal-head h1 { font-size: 28px; }
  .portal-login { order: 2; margin-top: 18px; }
  .portal-tiles { order: 3; margin-top: 26px; }
  .portal-head { order: 1; }
}

/* صورة الهوية */
.idup { border: 1px dashed var(--line-2); border-radius: 14px; padding: 12px 14px; background: var(--card-2); }
.idprev { display: flex; gap: 14px; align-items: flex-start; margin-top: 12px; flex-wrap: wrap; }
.idprev img { width: 220px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.idthumb { width: 260px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* شريط الرجوع والخروج أعلى كل صفحة */
.pagebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -6px 0 16px; }
.pagebar .pb-back, .pagebar .pb-exit { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-family: "Cairo", "Alexandria", sans-serif; font-weight: 900; font-size: 14px; border-radius: 12px; padding: 7px 14px; min-height: 38px; cursor: pointer; }
.pagebar .pb-back { background: var(--green); color: var(--gold); border: 1.5px solid var(--gold); }
.pagebar .pb-back svg, .pagebar .pb-exit svg { stroke: currentColor; }
.pagebar .pb-exit { background: #dc2626; color: #fff; border: 1.5px solid #fca5a5; }
.pagebar .pb-back:hover, .pagebar .pb-exit:hover { filter: brightness(1.08); }

/* نوافذ التنبيه المنبثقة */
.pop-bg { position: fixed; inset: 0; background: rgba(1,30,6,.55); z-index: 90; display: grid; place-items: center; padding: 16px; }
.pop { width: min(460px, 100%); background: #fff; border-radius: 22px; padding: 22px 22px 18px; border-top: 6px solid var(--gold-2); box-shadow: 0 30px 60px rgba(0,0,0,.35); text-align: center; animation: popIn .25s ease-out; }
.pop.tone-bad { border-top-color: #dc2626; } .pop.tone-ok { border-top-color: #22c55e; }
.pop h2 { font-size: 19px; margin: 8px 0 6px; color: var(--green-900); }
.pop p { margin: 0 0 16px; color: var(--soft); line-height: 1.9; }
.pop-ic { width: 54px; height: 54px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--green); stroke: var(--gold); }
.pop.tone-bad .pop-ic { background: #dc2626; stroke: #fff; }
.pop-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes popIn { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

/* اختيار طريقة السداد */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 11px; border: 1.5px solid var(--line-2); background: #fff; color: var(--soft); font-weight: 600; font-size: 14px; }
.seg input:checked + span { background: var(--green); color: var(--gold); border-color: var(--gold); }
.seg input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

/* مراجعة العقود المفتوحة (سلك الحرير) */
.rv-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.rv-chips a { --c: var(--green); display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line-2); color: var(--soft); font-size: 13px; }
.rv-chips a i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.rv-chips a.on { border-color: var(--green); background: #f4f9ec; color: var(--green-900); font-weight: 700; }
table.rv tbody tr { box-shadow: inset -4px 0 0 var(--c); }
table.rv select, table.rv input { min-height: 36px; padding: 6px 8px; font-size: 13px; }
table.rv .rv-n { min-width: 220px; }
@media print { .rv-s, .rv-n { border: 0 !important; background: transparent !important; } .rv-ok { display: none; } }
table.rv th, table.rv td { white-space: normal; font-size: 13px; padding: 8px; }
table.rv td:nth-child(3), table.rv td:nth-child(4) { max-width: 150px; }
table.rv .rv-n { min-width: 180px; width: 100%; }

/* شعار أعلى القائمة الجانبية (بدل المكعب الملون) */
.brand .brand-logo { display: block; width: 52px; height: 52px; object-fit: contain; flex: none; }
@media (max-width: 900px) { .topbar .brand .brand-logo { width: 42px; height: 34px; } }
