:root {
  --bg: #f6f7fb; --card: #fff; --ink: #14161f; --muted: #646a7d; --line: #e3e6ef;
  --accent: #4f6bff; --accent-ink: #fff; --ok: #12925a; --warn: #b26a00; --bad: #d23b3b;
  --soft: #eef1ff; --radius: 14px; --shadow: 0 1px 2px rgba(20,22,31,.05), 0 4px 16px rgba(20,22,31,.05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1117; --card: #181b24; --ink: #eceef5; --muted: #9aa0b4; --line: #2a2e3b;
    --accent: #7088ff; --soft: #20263b; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.6;
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .center { text-align: center; } .pad { padding: 2rem 1rem; }
.small { font-size: .85rem; } .ltr { direction: ltr; unicode-bidi: isolate; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; word-break: break-all; }
.hidden { display: none !important; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .6rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
#nav { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
#nav a { padding: .35rem .7rem; border-radius: 999px; color: var(--ink); font-size: .92rem; }
#nav a.on, #nav a:hover { background: var(--soft); text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; outline: none; }
.foot { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; display: flex; gap: 1rem; justify-content: space-between;
  color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.between { justify-content: space-between; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: .5rem 1rem; border-radius: 10px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem .75rem; width: 100%; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
label { display: block; font-size: .9rem; margin-bottom: .25rem; color: var(--muted); }
.field + .field { margin-top: .8rem; }
form .actions { margin-top: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); }
.check input { width: auto; }

.hero { text-align: center; padding: 1.5rem 0 1rem; }
.hero h1 { font-size: 1.9rem; }
.search { display: flex; gap: .5rem; max-width: 640px; margin: 1rem auto 0; }
.search input { font-size: 1.05rem; padding: .7rem 1rem; border-radius: 12px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: .25rem .8rem;
  cursor: pointer; font: inherit; font-size: .88rem; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.app { display: flex; gap: .8rem; align-items: center; color: var(--ink); }
.app:hover { text-decoration: none; border-color: var(--accent); }
.icon { width: 60px; height: 60px; border-radius: 14px; flex: none; background: var(--soft); object-fit: cover; border: 1px solid var(--line); }
.icon.lg { width: 112px; height: 112px; border-radius: 24px; }
.app .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app .sub { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: var(--soft); color: var(--muted); }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); } .badge.warn { color: var(--warn); }

.detail-head { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.fact { background: var(--soft); border-radius: 10px; padding: .5rem .75rem; }
.fact b { display: block; font-size: 1rem; }
.fact span { color: var(--muted); font-size: .8rem; }
.shots { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x mandatory; }
.shots img { height: 360px; border-radius: 14px; border: 1px solid var(--line); scroll-snap-align: start; }
.desc { white-space: pre-line; max-height: 14em; overflow: hidden; position: relative; }
.desc.open { max-height: none; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .7rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.bar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; color: var(--muted); padding: .5rem .9rem; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: start; padding: .5rem .4rem; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; border-top: 0; }
.scroll { overflow-x: auto; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: .5rem; }
.chart div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.note { background: var(--soft); border-radius: 10px; padding: .75rem 1rem; font-size: .9rem; }
.note.warn { border-inline-start: 3px solid var(--warn); }
.err { color: var(--bad); font-size: .9rem; margin-top: .5rem; }

#toast { position: fixed; inset-inline: 0; bottom: 1rem; margin: 0 auto; width: max-content; max-width: calc(100% - 2rem);
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; opacity: 0; transform: translateY(8px);
  transition: .25s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; transform: none; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .shots img { height: 280px; }
  .icon.lg { width: 84px; height: 84px; border-radius: 18px; }
  .top { flex-wrap: wrap; }
  .grid { grid-template-columns: 1fr; }
}
.w-auto { width: auto; }
.narrow { max-width: 440px; margin: 1rem auto; } .mid { max-width: 640px; margin: 0 auto; } .wide { max-width: 720px; margin: 0 auto; }
