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

:root {
  --p:#8B2B8F; --pd:#4B0B57; --acc:#D9B4FF;
    --bg:#07030B; --bg2:#120717; --bg3:#1A0B22; --bg4:#24102E;
  --card: rgba(20,16,34,.9); --b: rgba(255,255,255,.07); --bp: rgba(124,58,237,.25);
  --txt:#FFFFFF; --txt2:#D0C1DD; --txt3:#8D7A9D;
  --ok: #4ADE80; --warn: #FBBF24; --err: #F87171; --info: #818CF8;
  --r: 16px; --r2: 12px; --r3: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Tajawal', sans-serif; background: var(--bg); color: var(--txt);
  min-height: 100vh; direction: rtl; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(124,58,237,.18) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(37,99,235,.10) 0%, transparent 60%);
}
.z1 { position: relative; z-index: 1; }

/* ── LAYOUT ── */
.app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.content { flex: 1; padding: 16px 16px calc(70px + var(--safe-bottom)) 16px; max-width: 480px; margin: 0 auto; width: 100%; }
@media (min-width: 600px) { .content { padding: 24px 24px calc(80px + var(--safe-bottom)) 24px; max-width: 640px; } }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg2); border-top: 1px solid var(--b);
  display: flex; align-items: stretch;
  padding-bottom: var(--safe-bottom);
  backdrop-filter: blur(20px);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 4px; cursor: pointer; transition: all .2s; border: none; background: none;
  color: var(--txt3); font-family: 'Tajawal', sans-serif; font-size: 10px; gap: 3px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item .nav-ic { font-size: 22px; line-height: 1; transition: transform .2s; }
.nav-item.on { color: var(--acc); }
.nav-item.on .nav-ic { transform: translateY(-2px); }
.nav-badge { background: var(--err); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 10px; position: absolute; top: 6px; right: calc(50% - 18px); }

/* ── PAGE ── */
.pg { display: none; }
.pg.on { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── PAGE HEADER ── */
.pg-hdr { margin-bottom: 20px; }
.pg-ttl { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; }
.pg-sub { font-size: 12px; color: var(--txt2); margin-top: 3px; }

/* ── TOP BAR ── */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar-logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--p), var(--pd)); display: flex; align-items: center; justify-content: center; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 14px; color: #fff; }
.logo-text { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--txt); }
.logo-text small { display: block; font-size: 10px; font-weight: 400; color: var(--txt3); }
.topbar-av { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--p), var(--acc)); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer; flex-shrink: 0; }

/* ── STATS GRID ── */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--b); border-radius: var(--r); padding: 16px; position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; top: -16px; right: -16px; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle, var(--p) 0%, transparent 70%); opacity: .1; }
.stat-ic { font-size: 18px; margin-bottom: 8px; }
.stat-v { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.stat-l { font-size: 11px; color: var(--txt2); }

/* ── CHART ── */
.chart-box { background: var(--card); border: 1px solid var(--b); border-radius: var(--r); padding: 16px; margin-bottom: 20px; }
.chart-ttl { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--txt2); }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 100px; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 3px; }
.bar-v { font-size: 9px; color: var(--acc); font-weight: 700; min-height: 12px; }
.bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 3px; background: linear-gradient(to top, var(--p), var(--acc)); transition: height .4s ease; }
.bar.empty { background: var(--bg4); }
.bar-l { font-size: 9px; color: var(--txt3); }

/* ── CARD ── */
.card { background: var(--card); border: 1px solid var(--b); border-radius: var(--r); }
.card-p { padding: 16px; }

/* ── SUB CARD ── */
.sub-card { background: var(--card); border: 1px solid var(--b); border-radius: var(--r); padding: 14px; margin-bottom: 10px; position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.sub-card:active { opacity: .85; }
.sub-stripe { position: absolute; top: 0; right: 0; bottom: 0; width: 3px; }
.sp { background: linear-gradient(to bottom, var(--p), var(--acc)); }
.sc { background: linear-gradient(to bottom, #2563EB, #60A5FA); }
.sub-row { display: flex; align-items: center; gap: 12px; }
.sub-ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.sub-mid { flex: 1; min-width: 0; }
.sub-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.sub-tags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.tag { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.tag-p { background: rgba(124,58,237,.2); color: #C084FC; }
.tag-c { background: rgba(37,99,235,.2); color: #93C5FD; }
.tag-cat { background: rgba(255,255,255,.06); color: var(--txt3); }
.sub-right { text-align: left; flex-shrink: 0; }
.sub-price { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: var(--acc); }
.sub-cycle { font-size: 10px; color: var(--txt3); margin-top: 2px; }
.sub-footer { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--b); display: flex; align-items: center; justify-content: space-between; }
.sub-date { font-size: 11px; color: var(--txt2); }
.days-pill { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.dp-ok { background: rgba(74,222,128,.1); color: var(--ok); }
.dp-warn { background: rgba(251,191,36,.1); color: var(--warn); }
.dp-err { background: rgba(248,113,113,.1); color: var(--err); }
.sub-bank { font-size: 10px; color: var(--txt3); margin-top: 6px; }

/* ── INPUTS ── */
.inp, .sel {
  width: 100%; background: var(--bg4); border: 1px solid var(--b);
  border-radius: var(--r3); padding: 13px 14px;
  color: var(--txt); font-family: 'Tajawal', sans-serif; font-size: 15px;
  outline: none; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.inp:focus, .sel:focus { border-color: var(--p); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.inp::placeholder { color: var(--txt3); }
.sel option, .sel optgroup { background: var(--bg3); }
.form-g { margin-bottom: 16px; }
.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--txt2); margin-bottom: 7px; }
.lbl .opt { font-weight: 400; color: var(--txt3); font-size: 11px; }
.inp-hint { font-size: 11px; color: var(--txt3); margin-top: 5px; }
.inp-err { font-size: 11px; color: var(--err); margin-top: 5px; display: none; }
.inp.invalid { border-color: var(--err) !important; }

/* phone input */
.phone-wrap { position: relative; }
.phone-prefix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--txt2); font-weight: 700; pointer-events: none; }
.inp-phone { padding-right: 44px !important; letter-spacing: 1px; font-family: 'Syne', sans-serif; }

/* ── BUTTONS ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: var(--r2); border: none;
  cursor: pointer; font-family: 'Tajawal', sans-serif; font-size: 15px; font-weight: 700;
  transition: all .2s; -webkit-tap-highlight-color: transparent;
}
.btn-p {
  background: linear-gradient(135deg, #8B2B8F, #4B0B57);
  color: #fff;
  box-shadow: 0 8px 28px rgba(139,43,143,.45);
}
.btn-p:active { transform: scale(.97); }
.btn-g { background: var(--bg4); border: 1px solid var(--b); color: var(--txt); }
.btn-g:active { opacity: .8; }
.btn-d { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--err); }
.btn-sm { padding: 9px 16px; font-size: 13px; width: auto; border-radius: var(--r3); }

/* ── TOGGLE ── */
.type-tog { display: flex; background: var(--bg4); border: 1px solid var(--b); border-radius: var(--r2); padding: 3px; margin-bottom: 16px; }
.tog-opt { flex: 1; padding: 10px; text-align: center; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--txt2); transition: all .2s; }
.tog-p {
  background: linear-gradient(135deg, #8B2B8F, #4B0B57);
  color: #fff;
}
.tog-c {
  background: linear-gradient(135deg, #D9B4FF, #8B2B8F);
  color: #fff;
}
/* ── CHIPS ── */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 6px 12px; border-radius: 20px; font-size: 12px; border: 1px solid var(--b); background: var(--bg4); cursor: pointer; color: var(--txt2); transition: all .2s; font-family: 'Tajawal', sans-serif; -webkit-tap-highlight-color: transparent; }
.chip:active { opacity: .7; }
.chip.on { border-color: var(--p); background: rgba(124,58,237,.15); color: var(--acc); }

/* ── SERVICE GRID ── */
.svc-search { margin-bottom: 10px; }
.svc-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.svc-filters::-webkit-scrollbar { display: none; }
.svc-f-btn { padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; border: 1px solid var(--b); background: var(--bg4); color: var(--txt2); cursor: pointer; white-space: nowrap; font-family: 'Tajawal', sans-serif; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.svc-f-btn.on { border-color: var(--p); background: rgba(124,58,237,.2); color: var(--acc); }
.svc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 220px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 400px) { .svc-grid { grid-template-columns: repeat(5, 1fr); } }
.svc-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; background: var(--bg4); transition: all .2s; -webkit-tap-highlight-color: transparent; }
.svc-item:active { opacity: .8; }
.svc-item.on { border-color: var(--p); background: rgba(124,58,237,.15); }
.svc-emoji { font-size: 24px; }
.svc-name { font-size: 9px; color: var(--txt2); text-align: center; line-height: 1.2; }

/* ── SECTION HEADER ── */
.sec-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sec-ttl { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }

/* ── EMPTY ── */
.empty { text-align: center; padding: 50px 20px; color: var(--txt3); }
.empty-ic { font-size: 44px; margin-bottom: 12px; opacity: .4; }
.empty h3 { font-size: 15px; color: var(--txt2); margin-bottom: 8px; }

/* ── DIVIDER ── */
.hr { height: 1px; background: var(--b); margin: 18px 0; }

/* ── SPINNER ── */
.spin { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── UPLOAD ── */
.upload-z { border: 2px dashed var(--b); border-radius: var(--r2); padding: 20px; text-align: center; cursor: pointer; transition: border-color .2s; }
.upload-z:active { border-color: var(--p); }
.uprev { width: 52px; height: 52px; border-radius: 10px; margin: 0 auto 8px; display: none; object-fit: contain; }

/* ── NOTIF ITEM ── */
.notif-row { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--bg4); border: 1px solid var(--b); border-radius: var(--r2); margin-bottom: 10px; }

/* ── SWITCH ── */
.sw { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw-t { position: absolute; inset: 0; background: var(--bg4); border: 1px solid var(--b); border-radius: 13px; cursor: pointer; transition: .3s; }
.sw-t::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: var(--txt3); border-radius: 50%; transition: .3s; }
.sw input:checked + .sw-t { background: var(--p); border-color: var(--p); }
.sw input:checked + .sw-t::after { left: calc(100% - 21px); background: #fff; }

/* ── ADMIN TABLE ── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); border: 1px solid var(--b); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 500px; }
th { background: var(--bg4); padding: 11px 12px; text-align: right; font-size: 11px; color: var(--txt2); font-weight: 700; border-bottom: 1px solid var(--b); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--b); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(124,58,237,.04); }

/* ── PEND CARD ── */
.pend-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--bg4); border: 1px solid var(--b); border-radius: var(--r2); margin-bottom: 10px; }
.pend-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--bg3); border: 1px dashed var(--b); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; overflow: hidden; }
.pend-ico img { width: 100%; height: 100%; object-fit: contain; }

/* ── INSTALL BANNER ── */
.install-banner { background: linear-gradient(135deg, rgba(124,58,237,.15), rgba(37,99,235,.1)); border: 1px solid rgba(124,58,237,.3); border-radius: var(--r); padding: 14px 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.install-banner p { flex: 1; font-size: 13px; color: var(--txt2); line-height: 1.5; }

/* ── AUTH PAGE ── */
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-mark { width: 60px; height: 60px; border-radius: 18px; font-size: 22px; margin: 0 auto 12px; }
.auth-ttl { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--txt2); text-align: center; margin-bottom: 28px; }
.auth-tabs { display: flex; background: var(--bg4); border-radius: var(--r2); padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 11px; text-align: center; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--txt2); transition: all .25s; -webkit-tap-highlight-color: transparent; }
.auth-tab.on { background: linear-gradient(135deg, var(--p), var(--pd)); color: #fff; box-shadow: 0 4px 16px rgba(124,58,237,.4); }
.auth-sec { display: none; }
.auth-sec.on { display: block; }

/* scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--bp); border-radius: 10px; }

body:before{
  background:
    radial-gradient(circle at 50% 15%,
    rgba(139,43,143,.25) 0%,
    transparent 45%),

    radial-gradient(circle at 80% 90%,
    rgba(75,11,87,.35) 0%,
    transparent 40%);
}
