/* BiB Sales — التصميم
 * قاعدة السرعة: ممنوع backdrop-filter و filter:blur. الحركة بـ transform و opacity بس. */
:root {
  --gold: #c9a227; --gold2: #e3c45a; --on-gold: #0b1220; --gold-ink: var(--gold);
  --green: #22c55e; --red: #ef4444; --yellow: #f5b301; --blue: #3b82f6; --purple: #a78bfa;
  --bg: #0b1220; --bg2: #0f1829; --card: #141e33; --card2: #1a2640; --line: rgba(255,255,255,.08);
  --text: #e9edf5; --muted: #8b98b2; --shadow: 0 6px 20px rgba(0,0,0,.25);
  --r: 16px; --nav: 64px; --top: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f5f8; --bg2: #eceef3; --card: #ffffff; --card2: #f1f3f7; --line: rgba(11,18,32,.13);
  --text: #0b1220; --muted: #535d70; --shadow: 0 4px 16px rgba(11,18,32,.08); --on-gold: #0b1220;
  /* ألوان الكلام أغمق في الفاتح عشان تتقري على الأبيض (الخلفيات زي ما هي) */
  --yellow: #a86400; --green: #15803d; --red: #c81e1e; --gold-ink: #7d6312;
  color-scheme: light;
}
[data-theme="light"] .card, [data-theme="light"] .list-box, [data-theme="light"] .ccard, [data-theme="light"] .kpi,
[data-theme="light"] .tile, [data-theme="light"] .lib-tile, [data-theme="light"] .tabs { box-shadow: 0 1px 2px rgba(11,18,32,.06); }
[data-theme="light"] .badge.hot { color: #c2410c; border-color: rgba(194,65,12,.35); }
[data-theme="light"] .badge.cold, [data-theme="light"] .tile.blue b { color: #1d4ed8; }
[data-theme="light"] .badge.cold { border-color: rgba(29,78,216,.3); }
[data-theme="light"] .ccard.waiting { border-inline-start-color: #3b82f6; }
[data-theme="light"] .days i.ok { background: rgba(21,128,61,.16); }
[data-theme="light"] .warn-box { background: rgba(245,179,1,.14); border-color: rgba(168,100,0,.35); }
[data-theme="light"] .err-box { background: rgba(239,68,68,.08); border-color: rgba(200,30,30,.35); }
[data-theme="light"] .ok-box { background: rgba(34,197,94,.1); border-color: rgba(21,128,61,.35); }
[data-theme="light"] .banner { background: linear-gradient(135deg, rgba(201,162,39,.2), rgba(201,162,39,.06)); }
[data-theme="light"] .sheet-wrap { background: rgba(11,18,32,.45); }
[data-theme="light"] .login { background: radial-gradient(1000px 500px at 50% -10%, rgba(201,162,39,.22), transparent 60%), var(--bg); }
[data-theme="light"] .login .logo { box-shadow: 0 8px 24px rgba(11,18,32,.18); }

/* زرار اللغة + زرار السطوع — ظاهرين في الشريط اللي فوق في كل الشاشات */
.tgl { display: flex; gap: 4px; flex-shrink: 0; }
.tg {
  width: 40px; height: 40px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); display: grid; place-items: center; font-weight: 800; font-size: 14px; cursor: pointer; line-height: 1;
  font-family: 'Cairo', system-ui, sans-serif; transition: transform .12s;
}
.tg:active { transform: scale(.92); }
.tg svg { display: block; }
.tg-lang { letter-spacing: .3px; }
.tgl.float { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); inset-inline-end: 12px; z-index: 5; }
.login { position: relative; }
@media (max-width: 420px) { .topbar .btn .tx { display: none; } }
@media (max-width: 370px) { .tg { width: 36px; height: 36px; border-radius: 10px; } .topbar { gap: 6px; padding: 0 10px; } .tgl { gap: 3px; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-ink); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
small, .muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- الهيكل ---------- */
#app { min-height: 100%; }
.shell { display: flex; min-height: 100vh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--nav) + var(--safe-b) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; font-size: 20px; }
.topbar .ic:active { background: var(--card); }
.page { padding: 14px; max-width: 900px; margin: 0 auto; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.sync-dot.busy { background: var(--yellow); animation: pulse 1s infinite; }
.sync-dot.off { background: var(--muted); }
.sync-dot.err { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

/* الشريط السفلي — موبايل */
.bnav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: calc(var(--nav) + var(--safe-b));
  padding-bottom: var(--safe-b); display: flex; background: var(--bg2); border-top: 1px solid var(--line);
}
.bnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; position: relative; }
.bnav a .i { font-size: 21px; line-height: 1; }
.bnav a.on { color: var(--gold-ink); }
.bnav a.plus .i { width: 50px; height: 50px; border-radius: 50%; background: var(--gold); color: var(--on-gold); display: grid; place-items: center; font-size: 28px; font-weight: 700; margin-top: -22px; box-shadow: 0 6px 18px rgba(201,162,39,.35); }
.bnav .badge-dot { position: absolute; top: 8px; inset-inline-start: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; }

/* اللاب — قائمة جانبية + عمودين */
@media (min-width: 900px) {
  .bnav { display: none; }
  .main { padding-bottom: 24px; }
  .side {
    display: flex; flex-direction: column; width: 236px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    background: var(--bg2); border-inline-end: 1px solid var(--line); padding: 16px 10px; overflow-y: auto;
  }
  .side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
  .side .brand img { width: 38px; height: 38px; border-radius: 10px; }
  .side .brand b { font-size: 16px; display: block; line-height: 1.2; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; color: var(--text); font-weight: 600; font-size: 14.5px; }
  .side a .i { width: 22px; text-align: center; }
  .side a:hover { background: var(--card); }
  .side a.on { background: var(--card2); color: var(--gold-ink); }
  .side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
  .side .count { margin-inline-start: auto; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; }
  .side .add-btn { margin: 6px 4px 12px; }
  .page { padding: 20px 24px; max-width: 1100px; }
  .split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 0; height: calc(100vh - var(--top)); }
  .split > .col { overflow-y: auto; }
  .split > .col.list { border-inline-end: 1px solid var(--line); }
  .split .page { max-width: none; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
  .grid-2 > .card, .grid-3 > .card { margin-top: 0 !important; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .sheet-wrap { align-items: center !important; }
  .sheet { border-radius: 20px !important; max-height: 88vh !important; }
}

/* ---------- كروت وعناصر ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card + .card, .stack > * + * { margin-top: 10px; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.99); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.gap6 { gap: 6px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mb8 { margin-bottom: 8px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 20px 2px 10px; font-weight: 800; font-size: 15.5px; }
.sec-title .cnt { background: var(--card2); border: 1px solid var(--line); border-radius: 20px; padding: 0 9px; font-size: 12.5px; color: var(--muted); }
.sec-title .more { margin-inline-start: auto; font-size: 13px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .12s;
}
.btn:active { transform: scale(.97); }
.btn.gold { background: var(--gold); color: var(--on-gold); border-color: transparent; }
.btn.green { background: #1f9d55; color: #fff; border-color: transparent; }
.btn.wa { background: #1fa855; color: #fff; border-color: transparent; }
.btn.red { background: transparent; color: var(--red); border-color: rgba(239,68,68,.4); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.xs { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 17px; border-radius: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns.eq > * { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--card2); border-radius: 22px; padding: 6px 13px; font-size: 13.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; gap: 5px;
}
.chip.on { background: var(--gold); color: var(--on-gold); border-color: transparent; }
.chip.big { padding: 9px 15px; font-size: 14.5px; min-height: 44px; border-radius: 14px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 20px; background: var(--card2); border: 1px solid var(--line); white-space: nowrap; }
.badge.hot { color: #ff7a59; border-color: rgba(255,122,89,.35); }
.badge.warm { color: var(--yellow); border-color: rgba(245,179,1,.35); }
.badge.cold { color: #60a5fa; border-color: rgba(96,165,250,.35); }
.badge.gold { color: var(--gold-ink); border-color: rgba(201,162,39,.4); }
.badge.green { color: var(--green); border-color: rgba(34,197,94,.35); }
.badge.red { color: var(--red); border-color: rgba(239,68,68,.35); }

/* فورم */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.inp, select.inp, textarea.inp {
  width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); padding: 10px 12px; outline: none; font-size: 15.5px;
}
textarea.inp { min-height: 84px; resize: vertical; }
.inp:focus { border-color: var(--gold); }
.inp.big { min-height: 54px; font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.warn-box { background: rgba(245,179,1,.1); border: 1px solid rgba(245,179,1,.3); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.err-box { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ok-box { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.search { position: relative; }
.search .inp { padding-inline-start: 40px; }
.search::before { content: '🔍'; position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .7; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; cursor: pointer; }
.switch input { width: 46px; height: 26px; appearance: none; background: var(--card2); border: 1px solid var(--line); border-radius: 20px; position: relative; cursor: pointer; flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { background: #fff; transform: translateX(-20px); }
[dir="ltr"] .switch input:checked::after { transform: translateX(20px); }

/* ---------- شاشة النهارده ---------- */
.hello { margin: 6px 2px 14px; }
.hello h1 { font-size: 23px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; cursor: pointer; }
.tile b { display: block; font-size: 24px; font-weight: 800; line-height: 1.2; }
.tile span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tile.red b { color: var(--red); } .tile.yellow b { color: var(--yellow); } .tile.gold b { color: var(--gold-ink); } .tile.green b { color: var(--green); } .tile.blue b { color: #60a5fa; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); gap: 12px; } .tile { padding: 16px; } .tile b { font-size: 30px; } }
.banner { display: flex; align-items: center; gap: 12px; border-radius: 14px; padding: 12px 14px; margin-top: 10px; cursor: pointer; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(201,162,39,.16), rgba(201,162,39,.04)); }
.banner .e { font-size: 24px; }
.banner b { display: block; }

.ccard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 10px; border-inline-start: 4px solid var(--line); }
.ccard + .ccard { margin-top: 9px; }
.ccard.overdue { border-inline-start-color: var(--red); }
.ccard.today { border-inline-start-color: var(--yellow); }
.ccard.waiting { border-inline-start-color: #60a5fa; }
.ccard.hot { border-inline-start-color: #ff7a59; }
.ccard .top { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.ccard .nm { font-weight: 800; font-size: 15.5px; }
.ccard .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ccard .note { font-size: 13.5px; margin-top: 6px; color: var(--text); opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ccard .acts { display: grid; grid-template-columns: 1fr 52px 1.3fr; gap: 7px; margin-top: 10px; }
.ccard .acts .btn { min-height: 40px; padding: 0 8px; font-size: 13.5px; }
.ccard .when { font-size: 12px; font-weight: 700; white-space: nowrap; }
.ccard .when.red { color: var(--red); } .ccard .when.yellow { color: var(--yellow); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: var(--card2); color: var(--gold-ink); flex-shrink: 0; font-size: 16px; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; border: 1px dashed var(--line); border-radius: var(--r); font-size: 14px; }
.empty .e { font-size: 30px; display: block; margin-bottom: 4px; }

/* قايمة العملاء */
.litem { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.litem:hover { background: var(--card); }
.litem.on { background: var(--card2); }
.litem .nm { font-weight: 700; }
.litem .sub { font-size: 12.5px; color: var(--muted); }
.list-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list-box .litem:last-child { border-bottom: 0; }

.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.fsel { flex: 0 0 auto; min-height: 36px; padding: 4px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--card2); font-size: 13px; font-weight: 600; max-width: 180px; }

/* ملف العميل */
.phead { display: flex; gap: 12px; align-items: center; }
.phead .avatar { width: 54px; height: 54px; font-size: 22px; border-radius: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 14px; }
.tl::before { content: ''; position: absolute; inset-inline-start: -16px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--card2); border: 2px solid var(--gold); }
.tl.muted::before { border-color: var(--muted); }
.tl .h { font-size: 13px; color: var(--muted); }
.tl .b { font-size: 14.5px; white-space: pre-wrap; }
.stage-bar { display: flex; gap: 3px; margin-top: 10px; }
.stage-bar i { flex: 1; height: 6px; border-radius: 4px; background: var(--card2); }
.stage-bar i.on { background: var(--gold); }

/* bottom sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(5,9,18,.6); opacity: 0; transition: opacity .18s; }
.sheet-wrap.show { opacity: 1; }
.sheet {
  width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; background: var(--bg2); border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(18px + var(--safe-b)); transform: translateY(40px); transition: transform .2s ease-out; border: 1px solid var(--line);
}
.sheet-wrap.show .sheet { transform: none; }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet .sh-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet .sh-head h2 { flex: 1; }
.sheet .lbl { font-size: 13px; font-weight: 800; color: var(--muted); margin: 14px 0 7px; }
.sheet .foot { position: sticky; bottom: calc(-18px - var(--safe-b)); background: var(--bg2); padding: 12px 0 4px; margin-top: 10px; }

.toast-box { position: fixed; z-index: 90; inset-inline: 0; bottom: calc(var(--nav) + var(--safe-b) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .toast-box { bottom: 24px; } }
.toast { background: #1d2a44; color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: auto; max-width: 92vw; }
[data-theme="light"] .toast { background: #0b1220; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: #7f1d1d; }
.push-banner { position: fixed; z-index: 95; top: 10px; inset-inline: 10px; max-width: 480px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 18px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; transform: translateY(-140%); transition: transform .3s; cursor: pointer; }
.push-banner.show { transform: none; }
.push-banner img { width: 40px; height: 40px; border-radius: 10px; }

/* تابات */
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tabs button.on { background: var(--gold); color: var(--on-gold); }

/* أرقام وتقارير */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 26px; font-weight: 800; line-height: 1.25; }
.kpi .s { font-size: 12px; color: var(--muted); }
.prog { margin-top: 10px; }
.prog .pl { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-bottom: 5px; }
.prog .pt { height: 10px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.prog .pt i { display: block; height: 100%; border-radius: 6px; background: var(--gold); transform-origin: right; }
[dir="ltr"] .prog .pt i { transform-origin: left; }
.prog .pt i.done { background: var(--green); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; color: var(--muted); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.tbl-wrap { overflow-x: auto; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--card2); font-weight: 800; font-size: 13px; }
.rank.r1 { background: var(--gold); color: var(--on-gold); }
.streak { display: flex; align-items: center; gap: 12px; }
.streak .f { font-size: 34px; }
.streak b { font-size: 26px; }
.days { display: flex; gap: 4px; margin-top: 8px; }
.days i { flex: 1; height: 26px; border-radius: 7px; background: var(--card2); display: grid; place-items: center; font-style: normal; font-size: 10.5px; color: var(--muted); }
.days i.ok { background: rgba(34,197,94,.25); color: var(--green); }

/* مكتبة */
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lib-tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; cursor: pointer; }
.lib-tile .e { font-size: 26px; }
.lib-tile b { display: block; margin-top: 4px; }
.lib-tile span { font-size: 12.5px; color: var(--muted); }
.proj-card { background: linear-gradient(140deg, var(--card2), var(--card)); }
.msg { white-space: pre-wrap; font-size: 14.5px; background: var(--bg2); border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); }
.md { font-size: 15px; }
.md h1 { font-size: 21px; margin: 18px 0 8px; } .md h2 { font-size: 18px; margin: 18px 0 8px; color: var(--gold-ink); } .md h3 { font-size: 16px; margin: 14px 0 6px; }
.md p { margin: 6px 0; } .md ul, .md ol { padding-inline-start: 22px; margin: 6px 0; } .md li { margin: 3px 0; }
.md table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; display: block; overflow-x: auto; }
.md td, .md th { border: 1px solid var(--line); padding: 6px 8px; text-align: start; }
.md th { background: var(--card2); }
.md blockquote { margin: 8px 0; padding: 8px 12px; border-inline-start: 3px solid var(--gold); background: var(--card2); border-radius: 8px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md code { background: var(--card2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.cmp { overflow-x: auto; }
.cmp table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13.5px; }
.cmp th, .cmp td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: start; min-width: 140px; }
.cmp th:first-child, .cmp td:first-child { position: sticky; inset-inline-start: 0; background: var(--bg); min-width: 96px; color: var(--muted); font-weight: 700; }
.calc-out { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc-out .kpi .v { font-size: 20px; }

/* يومي */
.block { display: flex; gap: 12px; align-items: flex-start; }
.block .tm { font-weight: 800; font-size: 13px; color: var(--gold-ink); width: 52px; flex-shrink: 0; padding-top: 2px; }
.block .ck { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); flex-shrink: 0; display: grid; place-items: center; cursor: pointer; background: transparent; }
.block .ck.on { background: var(--green); border-color: var(--green); color: #fff; }
.block.done .t { text-decoration: line-through; opacity: .6; }

/* دخول + شاشة الفتح */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1000px 500px at 50% -10%, rgba(201,162,39,.18), transparent 60%), var(--bg); }
.login .box { width: 100%; max-width: 380px; }
.login .logo { width: 86px; height: 86px; border-radius: 22px; display: block; margin: 0 auto 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #0b1220; transition: opacity .35s; }
.splash.out { opacity: 0; pointer-events: none; }
.splash .in { text-align: center; }
.splash img { width: 104px; height: 104px; border-radius: 26px; animation: pop .7s cubic-bezier(.2,1.4,.4,1) both; }
.splash b { display: block; color: #fff; font-size: 24px; font-weight: 800; margin-top: 14px; letter-spacing: .5px; animation: up .6s .25s both; }
.splash span { display: block; color: var(--gold); font-size: 14px; font-weight: 700; animation: up .6s .4s both; }
.splash .ln { width: 120px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); margin: 18px auto 0; overflow: hidden; }
.splash .ln i { display: block; height: 100%; width: 40%; background: var(--gold); border-radius: 3px; animation: slide 1.1s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide { from { transform: translateX(160%); } to { transform: translateX(-260%); } }
.demo-pill { position: fixed; z-index: 40; left: 6px; bottom: calc(var(--nav) + var(--safe-b) + 6px); background: var(--gold); color: var(--on-gold); font-size: 10.5px; font-weight: 800; padding: 0 8px; border-radius: 8px; pointer-events: none; opacity: .85; }
@media (min-width: 900px) { .demo-pill { bottom: 8px; } }
.wizard-steps { display: flex; gap: 6px; margin-bottom: 16px; }
.wizard-steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--card2); }
.wizard-steps i.on { background: var(--gold); }
.qr { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.qr canvas { display: block; }
.chk { width: 22px; height: 22px; accent-color: var(--gold); flex-shrink: 0; }
.fadein { animation: fadein .18s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
