/* M512 Viral Content — هوية 512 / محمد مفيد */
:root {
  --bg: #101E27;
  --bg-2: #0C1820;
  --surface: #1A2A34;
  --surface-2: #303E47;
  --line: #33444F;
  --line-soft: #26363F;
  --ink: #F5F5F5;
  --muted: #9FB0B8;
  --faint: #6F8591;
  --accent: #6BB8B5;
  --hi: #9AD3D0;
  --accent-deep: #3C8D8A;
  --accent-ink: #101E27;
  --paper: #F5F5F5;
  --paper-line: #B7C1C6;
  --danger: #E08A7E;
  --grad-hero: radial-gradient(120% 140% at 10% 100%, #B4E3E0 0%, #6BB8B5 24%, #3C8D8A 48%, #1F4B55 72%, #101E27 100%);
  --grad-deep: radial-gradient(90% 120% at 70% 30%, #3E9794 0%, #2A6F70 40%, #1C4751 75%, #132A34 100%);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --glow: 0 6px 20px rgba(107, 184, 181, .25);
  --side: 264px;
  font-family: "Alexandria", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Alexandria", system-ui, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--hi); text-decoration: none; }
a:hover { color: var(--ink); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
.tone { color: var(--accent); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
.num { font-feature-settings: "tnum"; direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- الهيكل ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-2); border-inline-start: 1px solid var(--line-soft);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; color: var(--ink); }
.brand .logo { width: 62px; color: var(--accent); flex: none; }
.brand .logo svg { width: 100%; height: auto; display: block; }
.brand .wordmark { border-inline-start: 1px solid var(--line); padding-inline-start: 12px; line-height: 1.25; }
.brand .wordmark b { display: block; font-weight: 800; font-size: 1.02rem; direction: ltr; text-align: right; }
.brand .wordmark small { color: var(--muted); font-size: .72rem; }
.nav-label { font-size: .72rem; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: .93rem; position: relative; transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active { background: var(--surface-2); color: var(--ink); }
.nav a.active::before {
  content: ""; position: absolute; inset-inline-start: -16px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--accent);
}
.nav a .count { margin-inline-start: auto; font-size: .72rem; background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 8px; font-weight: 700; }
.sidebar .me { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-deep); display: grid; place-items: center; font-weight: 700; color: var(--ink); flex: none; }
.me .who { line-height: 1.3; min-width: 0; }
.me .who b { display: block; font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who small { color: var(--muted); font-size: .72rem; }
.me button { margin-inline-start: auto; }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.topbar { display: none; }
.demo-banner {
  background: var(--grad-deep); color: var(--ink); border-radius: var(--radius); padding: 10px 16px;
  margin-bottom: 20px; font-size: .86rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.demo-banner b { font-weight: 700; }

/* ---------- رأس الصفحة ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); font-weight: 800; margin: 0; line-height: 1.25; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.eyebrow svg { width: 16px; height: 16px; }
.bookmark-mark { width: 26px; margin-bottom: 8px; color: var(--accent); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 16px; cursor: pointer;
  font-weight: 600; font-size: .9rem; line-height: 1.4; transition: transform .1s, background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }
.btn.primary:hover { background: var(--hi); border-color: var(--hi); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn.icon { padding: 8px; }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- البطاقات والحقول ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel.active { background: var(--surface-2); border-inline-start: 4px solid var(--accent); }
.panel + .panel { margin-top: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 700; }
.panel h3 + p { margin: 0 0 14px; color: var(--muted); font-size: .88rem; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.field small { color: var(--faint); font-size: .76rem; line-height: 1.5; }
.input, select.input, textarea.input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: .92rem;
}
textarea.input { resize: vertical; min-height: 90px; line-height: 1.7; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(107, 184, 181, .18); }
.input::placeholder { color: var(--faint); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 14px 50%, 19px 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 32px; }
.input.ltr { direction: ltr; text-align: left; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; border: 0; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch .txt b { display: block; font-weight: 600; font-size: .92rem; }
.switch .txt small { color: var(--muted); font-size: .8rem; }
.switch input { appearance: none; width: 44px; height: 24px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: inset-inline-start .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { inset-inline-start: 23px; background: var(--accent-ink); }

/* ---------- الشارات ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px; font-size: .74rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); background: transparent; white-space: nowrap; line-height: 1.7; }
.pill svg { width: 13px; height: 13px; }
.pill.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.outline { border-color: var(--accent); color: var(--hi); }
.tier-mega { background: var(--grad-hero); border: 0; color: var(--accent-ink); font-weight: 800; }
.tier-viral { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tier-hot { border-color: var(--accent); color: var(--hi); background: rgba(107, 184, 181, .12); }
.tier-good { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
.tier-normal { border-color: var(--line); color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 99px; padding: 5px 14px; cursor: pointer; font-size: .84rem; font-weight: 500; transition: all .15s; }
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; display: inline-flex; gap: 6px; align-items: center; }
.seg button svg { width: 15px; height: 15px; }
.seg button.on { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- البحث ---------- */
.search-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 22px; }
.search-main { display: flex; gap: 10px; }
.search-main .input { font-size: 1.02rem; padding: 12px 16px; }
.search-main .btn { padding: 0 22px; }
.search-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.hint { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
.hint svg { width: 17px; height: 17px; color: var(--accent); flex: none; margin-top: 3px; }

/* ---------- الفلاتر ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 18px; }
.filters .input { width: auto; padding: 7px 10px; font-size: .84rem; }
.filters select.input { padding-inline-end: 30px; }
.filters .grow { flex: 1 1 180px; }
.filters .lbl { font-size: .76rem; color: var(--faint); }
.result-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: .85rem; flex-wrap: wrap; }

/* ---------- شبكة الفيديو ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; align-items: start; }
.vgrid.vertical { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s; display: flex; flex-direction: column; animation: rise .4s both; }
.vcard:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.vcard .thumb { position: relative; aspect-ratio: 16 / 9; background: var(--bg-2); overflow: hidden; }
.vcard.vert .thumb { aspect-ratio: 9 / 14; }
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.vcard:hover .thumb img { transform: scale(1.04); }
.vcard .thumb .top { position: absolute; top: 8px; inset-inline: 8px; display: flex; justify-content: space-between; gap: 6px; }
.vcard .thumb .bottom { position: absolute; bottom: 8px; inset-inline: 8px; display: flex; justify-content: space-between; align-items: flex-end; gap: 6px; }
.badge-plat { display: inline-flex; align-items: center; gap: 5px; background: rgba(16, 30, 39, .82); backdrop-filter: blur(6px); color: var(--ink); border-radius: 99px; padding: 2px 9px 2px 8px; font-size: .7rem; font-weight: 600; }
.badge-plat svg { width: 13px; height: 13px; color: var(--accent); }
.badge-dur { background: rgba(16, 30, 39, .85); color: var(--ink); border-radius: 6px; padding: 1px 7px; font-size: .72rem; font-weight: 600; direction: ltr; }
.score-ring { --p: 50; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(16, 30, 39, .75) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: rgba(16, 30, 39, .92); }
.score-ring b { position: relative; font-size: .86rem; font-weight: 800; }
.vcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.vcard h4 { margin: 0; font-size: .92rem; font-weight: 600; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard .channel { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: flex; gap: 12px; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.stats span { display: inline-flex; align-items: center; gap: 4px; }
.stats svg { width: 14px; height: 14px; color: var(--faint); }
.vcard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 6px; }
.vcard .why { font-size: .8rem; color: var(--ink); background: var(--bg); border-inline-start: 3px solid var(--accent); border-radius: 6px; padding: 6px 10px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fav-btn { background: rgba(16, 30, 39, .82); border: 0; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.fav-btn svg { width: 16px; height: 16px; }
.fav-btn.on { color: var(--accent); }
.fav-btn.on svg { fill: currentColor; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- الحالات الفارغة ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
.empty .ico { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; background: var(--grad-deep); display: grid; place-items: center; color: var(--ink); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-weight: 700; }
.empty p { margin: 0 auto 16px; max-width: 460px; font-size: .9rem; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- تفاصيل الفيديو ---------- */
.overlay { position: fixed; inset: 0; background: rgba(6, 12, 16, .72); backdrop-filter: blur(4px); z-index: 50; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 32px 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; width: min(1120px, 100%); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; animation: rise .3s; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); gap: 10px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.sheet-body { display: grid; grid-template-columns: 360px 1fr; gap: 0; }
.sheet-side { padding: 20px; border-inline-end: 1px solid var(--line-soft); background: var(--bg-2); display: flex; flex-direction: column; gap: 16px; }
.sheet-main { padding: 22px 26px 30px; min-width: 0; }
.sheet .thumb-lg { border-radius: var(--radius); overflow: hidden; position: relative; background: var(--surface); }
.sheet .thumb-lg img { width: 100%; }
.sheet .thumb-lg.vert { max-width: 250px; margin: 0 auto; }
.sheet h2 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 700; line-height: 1.5; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.metric { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; }
.metric small { display: block; color: var(--muted); font-size: .72rem; }
.metric b { font-size: 1.05rem; font-weight: 700; }
.score-hero { background: var(--grad-hero); border-radius: var(--radius); padding: 16px 18px; color: var(--accent-ink); display: flex; align-items: center; gap: 16px; }
.score-hero .big { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.score-hero .lbl { font-weight: 700; font-size: 1rem; }
.score-hero small { display: block; font-size: .76rem; opacity: .8; }
.bar { height: 7px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); border-radius: 99px; }
.part { display: grid; grid-template-columns: 110px 1fr 38px; gap: 10px; align-items: center; font-size: .8rem; color: var(--muted); }
.part b { color: var(--ink); text-align: left; font-weight: 600; }
.sec { margin-bottom: 22px; }
.sec h3 { display: flex; align-items: center; gap: 8px; font-size: .95rem; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.sec h3 svg { width: 18px; height: 18px; color: var(--accent); }
.sec p { margin: 0; color: #D8E0E4; font-size: .92rem; }
.a-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.a-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.a-card small { color: var(--accent); font-weight: 600; font-size: .76rem; display: block; margin-bottom: 4px; }
.a-card p { margin: 0; font-size: .88rem; color: #D8E0E4; }
.hook-box { background: var(--surface-2); border-inline-start: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; }
.hook-box .q { font-size: 1.02rem; font-weight: 600; margin: 4px 0 6px; }
.reasons { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: r; }
.reasons li { counter-increment: r; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.reasons li::before { content: counter(r, decimal-leading-zero); font-weight: 800; color: var(--accent); font-size: 1.05rem; direction: ltr; }
.lesson { background: var(--grad-deep); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; }
.lesson small { font-weight: 600; opacity: .85; }
.lesson p { margin: 4px 0 0; font-weight: 600; font-size: 1rem; }
.paper { background: var(--paper); color: var(--bg); border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--paper-line); }
.paper .tone { color: var(--accent-deep); }
.paper pre { white-space: pre-wrap; font-family: inherit; margin: 0; font-size: .9rem; line-height: 1.9; max-height: 340px; overflow: auto; }
.scenes { width: 100%; border-collapse: collapse; font-size: .84rem; }
.scenes th { text-align: start; color: var(--accent-deep); font-weight: 700; border-bottom: 2px solid var(--accent); padding: 6px 8px; }
.scenes td { border-bottom: 1px solid var(--paper-line); padding: 7px 8px; vertical-align: top; }
.scenes td:first-child { direction: ltr; text-align: right; white-space: nowrap; font-weight: 600; width: 90px; }
details.fold { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; background: var(--surface); }
details.fold summary { padding: 12px 16px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary svg { width: 18px; height: 18px; color: var(--accent); }
details.fold summary .chev { margin-inline-start: auto; transition: transform .2s; color: var(--muted); }
details.fold[open] summary .chev { transform: rotate(180deg); }
details.fold .inner { padding: 0 16px 16px; }
.claude-box { border: 1px solid var(--accent); border-radius: var(--radius); padding: 16px; background: rgba(107, 184, 181, .06); }
.claude-box h4 { margin: 0 0 4px; font-weight: 700; }
.claude-box p { margin: 0 0 12px; color: var(--muted); font-size: .86rem; }
.analyzing { text-align: center; padding: 40px 10px; }
.analyzing .pulse { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--grad-hero); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.05); opacity: 1; } }

/* ---------- الإحصاءات والجداول ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile small { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 6px; }
.tile small svg { width: 15px; height: 15px; color: var(--accent); }
.tile b { display: block; font-size: 2rem; font-weight: 800; line-height: 1.3; margin-top: 4px; }
.tile.hero { background: var(--grad-hero); color: var(--accent-ink); border: 0; }
.tile.hero small, .tile.hero small svg { color: var(--accent-ink); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: .78rem; padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(255, 255, 255, .02); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.checklist .ok, .checklist .no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.checklist .ok { background: var(--accent); color: var(--accent-ink); }
.checklist .no { border: 1.5px dashed var(--faint); color: var(--faint); }
.checklist svg { width: 13px; height: 13px; }

/* ---------- التبويبات ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: .88rem; border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button svg { width: 16px; height: 16px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.key-field { position: relative; }
.key-field .input { padding-inline-end: 44px; }
.key-field button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(s, decimal-leading-zero); font-size: 1.4rem; font-weight: 800; color: var(--accent); direction: ltr; line-height: 1.4; }
.steps b { display: block; font-weight: 600; }
.steps span { color: var(--muted); font-size: .88rem; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .84em; direction: ltr; unicode-bidi: isolate; }
.token-box { display: flex; gap: 8px; align-items: center; }
.token-box .code { flex: 1; padding: 10px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- الدخول ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: var(--grad-hero); padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; color: var(--ink); position: relative; overflow: hidden; }
.auth-hero .logo { width: 110px; color: var(--ink); }
.auth-hero h1 { font-size: clamp(2.4rem, 5.4vw, 4.6rem); font-weight: 800; line-height: 1.15; margin: 0 0 14px; direction: ltr; text-align: right; }
.auth-hero h1 .dark { color: var(--accent-ink); }
.auth-hero p { font-size: clamp(1.05rem, 1.8vw, 1.35rem); max-width: 520px; margin: 0; color: var(--ink); }
.auth-hero .feat { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.auth-hero .feat span { background: rgba(16, 30, 39, .35); border: 1px solid rgba(245, 245, 245, .25); border-radius: 99px; padding: 5px 14px; font-size: .84rem; display: inline-flex; gap: 6px; align-items: center; }
.auth-hero .feat svg { width: 15px; height: 15px; }
.auth-hero .sig { font-size: .82rem; opacity: .85; display: flex; align-items: center; gap: 10px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; }
.auth-card > p { color: var(--muted); margin: 0 0 22px; }
.auth-card form { display: grid; gap: 14px; }
.msg { border-radius: 10px; padding: 10px 14px; font-size: .86rem; }
.msg.err { background: rgba(224, 138, 126, .1); border: 1px solid rgba(224, 138, 126, .4); color: #F2C0B8; }
.msg.ok { background: rgba(107, 184, 181, .1); border: 1px solid rgba(107, 184, 181, .4); color: var(--hi); }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; text-align: center; }

/* ---------- التنبيهات ---------- */
.toasts { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%); z-index: 99; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { background: var(--surface-2); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 10px; padding: 11px 16px; box-shadow: var(--shadow); font-size: .88rem; animation: rise .25s; }
.toast.err { border-inline-start-color: var(--danger); }

/* ---------- الجوال ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 60; transform: translateX(100%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 55; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--bg); z-index: 40; }
  .topbar .brand { padding: 0; }
  .topbar .brand .logo { width: 48px; }
  .main { padding: 20px 16px 50px; }
  .sheet-body { grid-template-columns: 1fr; }
  .sheet-side { border-inline-end: 0; border-bottom: 1px solid var(--line-soft); }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { min-height: 340px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .a-grid { grid-template-columns: 1fr; }
  .search-main { flex-direction: column; }
  .search-main .btn { padding: 11px; }
  .vgrid { grid-template-columns: 1fr; }
  .vgrid.vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vgrid.vertical .vcard .why, .vgrid.vertical .stats span:nth-child(3) { display: none; }
  .overlay { padding: 0; }
  .sheet { border-radius: 0; min-height: 100vh; }
  .sheet-main { padding: 18px 16px 30px; }
  .filters .input { flex: 1 1 45%; }
  .part { grid-template-columns: 90px 1fr 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.demo-banner svg { width: 18px; height: 18px; flex: none; }
.panel h3 svg, .search-panel h3 svg, .claude-box h4 svg { width: 18px; height: 18px; vertical-align: -3px; color: var(--accent); }
.part span svg { width: 15px; height: 15px; vertical-align: -3px; color: var(--accent); }
.checklist li b { font-weight: 600; }
.key-field .input { padding-left: 44px; padding-right: 12px; }
.key-field button { left: 6px; right: auto; inset-inline-end: auto; }
