/* =====================================================================
   Shortvana — design system
   Logical properties (inline-start/end) so the same CSS works RTL (عربي) and LTR (English).
   Light + dark themes via [data-theme] on <html>.
   ===================================================================== */

:root {
    --brand-1: #6d5dfc;
    --brand-2: #b05cff;
    --brand-grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    --gold: #f2b84b;

    --bg: #f4f5fb;
    --surface: #ffffff;
    --surface-2: #f8f9fd;
    --text: #151a2d;
    --text-2: #4a5170;
    --muted: #8a90a8;
    --border: #e6e8f2;
    --border-strong: #d5d8e6;
    --ring: rgba(109, 93, 252, .25);

    --ok: #0f9f6e;      --ok-bg: #e3f8ef;
    --warn: #c47a00;    --warn-bg: #fff3dc;
    --info: #2f6bff;    --info-bg: #e5edff;
    --err: #e0445a;     --err-bg: #ffe8eb;

    --sidebar-bg: #11142b;
    --sidebar-text: #aab0cf;
    --sidebar-active: #ffffff;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(20, 24, 54, .04), 0 6px 24px rgba(20, 24, 54, .06);
    --shadow-lg: 0 10px 40px rgba(20, 24, 54, .14);
    --font: "Cairo", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html[lang="en"] { --font: "Inter", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif; }

html[data-theme="dark"] {
    --bg: #0b0e1d;
    --surface: #141832;
    --surface-2: #1a1f3d;
    --text: #eef0fb;
    --text-2: #c2c6e0;
    --muted: #8a90b5;
    --border: #252b4f;
    --border-strong: #323a66;
    --ring: rgba(176, 92, 255, .35);
    --ok-bg: rgba(15, 159, 110, .16);  --ok: #3ddca4;
    --warn-bg: rgba(242, 184, 75, .15); --warn: #f2b84b;
    --info-bg: rgba(47, 107, 255, .18); --info: #7ea4ff;
    --err-bg: rgba(224, 68, 90, .16);   --err: #ff7a8c;
    --sidebar-bg: #090b18;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
       -webkit-font-smoothing: antialiased; }
a { color: var(--brand-1); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }
.ti { font-size: 1.15em; line-height: 1; vertical-align: -0.15em; }

/* ---------------- App shell ---------------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); padding: 22px 16px; display: flex; flex-direction: column;
           position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-grad); display: grid; place-items: center;
              color: #fff; font-size: 22px; box-shadow: 0 6px 18px rgba(109, 93, 252, .45); flex: none; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: .2px; line-height: 1.2; }
.brand-tag { font-size: 11.5px; color: var(--sidebar-text); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--sidebar-text);
         font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s; }
.nav a .ti { font-size: 20px; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(135deg, rgba(109, 93, 252, .35), rgba(176, 92, 255, .25)); color: var(--sidebar-active);
                box-shadow: inset 0 0 0 1px rgba(176, 92, 255, .35); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 16px;
                border-top: 1px solid rgba(255, 255, 255, .08); }
.side-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border-radius: 12px; border: 0;
            background: rgba(255, 255, 255, .05); color: var(--sidebar-text); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.side-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.side-btn .ti { font-size: 19px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 36px 60px; }

.backdrop { display: none; }

/* ---------------- Page header ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.3px; line-height: 1.25; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.crumb:hover { color: var(--brand-1); text-decoration: none; }
html[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------------- Cards & sections ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 22px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16.5px; margin: 0; }
.card-title .icon-chip { width: 34px; height: 34px; font-size: 18px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; margin: 30px 0 14px; }

.icon-chip { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 22px; flex: none;
             background: var(--surface-2); color: var(--brand-1); }
.chip-brand { background: rgba(109, 93, 252, .12); color: var(--brand-1); }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-err { background: var(--err-bg); color: var(--err); }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 18px; display: flex; align-items: center; gap: 14px; }
.stat .n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border-strong);
       background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 11px; font: inherit; font-weight: 700;
       font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform .08s, box-shadow .15s, background .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(109, 93, 252, .35); }
.btn-primary:hover { background: var(--brand-grad); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-bg); border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-icon { padding: 8px; width: 38px; height: 38px; }
.btn-block { width: 100%; }

/* ---------------- Badges & pills ---------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px;
         font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.badge .ti { font-size: 14px; }
.st-pending { background: var(--warn-bg); color: var(--warn); }
.st-processing { background: var(--info-bg); color: var(--info); }
.st-processing .ti { animation: spin 1.2s linear infinite; }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-failed { background: var(--err-bg); color: var(--err); }
.st-cancelled { background: var(--surface-2); color: var(--muted); text-decoration: none; }
.badge-brand { background: rgba(109, 93, 252, .12); color: var(--brand-1); }
.badge-gold { background: rgba(242, 184, 75, .16); color: #b07800; }
html[data-theme="dark"] .badge-gold { color: var(--gold); }
@keyframes spin { to { transform: rotate(360deg); } }

.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta .item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; font-weight: 600;
              background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ltr { direction: ltr; text-align: left; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
form.inline { display: inline-flex; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { margin-bottom: 14px; }
label, .label { display: block; font-weight: 700; margin: 0 0 7px; font-size: 13.5px; color: var(--text); }
.hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=time], input[type=datetime-local], select, textarea {
    width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 11px; font: inherit; font-size: 14.5px;
    background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-1); box-shadow: 0 0 0 4px var(--ring); }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
         background: var(--surface-2); font-weight: 600; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand-1); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; padding: 14px 0 4px;
                background: linear-gradient(to top, var(--bg) 70%, transparent); }
.validation { color: var(--err); }
.validation ul { margin: 0 0 12px; padding-inline-start: 18px; }

/* visual source picker */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice .box { height: 100%; border: 1.5px solid var(--border-strong); border-radius: 13px; padding: 13px; background: var(--surface);
               display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s, background .15s; }
.choice .box .ti { font-size: 22px; color: var(--brand-1); }
.choice .box b { font-size: 14px; }
.choice .box span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.choice input:checked + .box { border-color: var(--brand-1); box-shadow: 0 0 0 4px var(--ring); background: rgba(109, 93, 252, .05); }
.choice input:focus-visible + .box { box-shadow: 0 0 0 4px var(--ring); }

/* ---------------- Flash ---------------- */
.flash { display: flex; align-items: center; gap: 10px; background: var(--ok-bg); color: var(--ok); padding: 12px 16px;
         border-radius: 12px; margin-bottom: 20px; font-weight: 600; }
.error-box { background: var(--err-bg); color: var(--err); padding: 13px 16px; border-radius: 12px; white-space: pre-wrap;
             font-size: 13px; direction: ltr; text-align: left; margin-bottom: 20px; overflow-wrap: anywhere; }

/* ---------------- Tables (become cards on mobile) ---------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.rtable { width: 100%; border-collapse: collapse; }
.rtable th, .rtable td { padding: 13px 16px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rtable th { background: var(--surface-2); font-weight: 700; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }
.rtable tr:last-child td { border-bottom: 0; }
.rtable tbody tr { transition: background .12s; }
.rtable tbody tr:hover { background: var(--surface-2); }
.rtable .title-cell a { font-weight: 700; color: var(--text); }
.rtable .title-cell a:hover { color: var(--brand-1); }
.rtable .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------------- Series cards ---------------- */
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.series-card { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.series-card h2 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.35; }
.series-card .niche { color: var(--text-2); font-size: 13.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.series-card .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-form { display: flex; gap: 8px; margin-top: auto; }
.gen-form input { flex: 1; min-width: 0; }

/* ---------------- Video details ---------------- */
.video-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.player { position: sticky; top: 24px; }
.player video, .player .placeholder { width: 100%; aspect-ratio: 9/16; border-radius: 18px; background: #000; display: block; box-shadow: var(--shadow-lg); }
.placeholder { display: grid !important; place-items: center; text-align: center; padding: 24px; color: var(--muted);
               background: var(--surface-2) !important; border: 2px dashed var(--border-strong); box-shadow: none !important; }
.placeholder .ti { font-size: 40px; display: block; margin: 0 auto 8px; }
.copy-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px; white-space: pre-wrap; font-size: 14px; }
.action-list { display: grid; gap: 8px; }

.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.scene { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 12px; }
.scene img, .scene .noimg { width: 72px; aspect-ratio: 9/16; object-fit: cover; border-radius: 9px; background: var(--surface-2); flex: none; }
.scene .num { font-weight: 800; color: var(--brand-1); font-size: 12.5px; }
.scene .text { font-size: 13.5px; line-height: 1.55; }
.scene .foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------------- Characters ---------------- */
.char-grid { display: grid; gap: 18px; }
.char-card { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: start; margin: 0; }
.char-img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 14px; background: var(--surface-2); display: block; }
.char-img.empty { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; padding: 12px; border: 2px dashed var(--border-strong); }
.char-img.empty .ti { font-size: 34px; display: block; margin: 0 auto 6px; }
.file-pick { display: inline-flex; align-items: center; gap: 8px; }
.file-pick input[type=file] { max-width: 190px; font-size: 12.5px; color: var(--muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .ti { font-size: 44px; color: var(--border-strong); display: block; margin-bottom: 10px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .video-layout { grid-template-columns: 300px 1fr; }
}

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    html[dir="rtl"] .sidebar { transform: translateX(105%); }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 10, 24, .5); z-index: 30; }

    .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 16px;
              background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
    .topbar .brand { padding: 0; color: var(--text); }
    .topbar .brand-logo { width: 34px; height: 34px; font-size: 18px; }
    .topbar .brand-name { font-size: 16px; }

    .content { padding: 20px 16px 50px; }
    .page-head h1 { font-size: 23px; }
    .video-layout { grid-template-columns: 1fr; }
    .player { position: static; max-width: 360px; margin: 0 auto; width: 100%; }
    .char-card { grid-template-columns: 120px 1fr; gap: 14px; }
}

@media (max-width: 640px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 14px; gap: 10px; }
    .stat .icon-chip { width: 38px; height: 38px; font-size: 19px; }
    .stat .n { font-size: 22px; }
    .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .series-grid { grid-template-columns: 1fr; }
    .gen-form { flex-direction: column; }
    .card { padding: 16px; }
    .char-card { grid-template-columns: 1fr; }
    .char-card .char-img { max-width: 200px; margin: 0 auto; }

    /* table → cards */
    .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
    .rtable thead { display: none; }
    .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
    .rtable tr { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; padding: 8px 4px; box-shadow: var(--shadow); }
    .rtable td { border: 0; padding: 6px 14px; display: flex; justify-content: space-between; gap: 12px; }
    .rtable td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 700; flex: none; }
    .rtable td.title-cell { display: block; }
    .rtable td.title-cell::before { display: none; }
    .rtable td.num-cell { display: none; }
}

/* ---------------- Auth pages (login / register) ---------------- */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 44%) 1fr; }
.auth-side { background: radial-gradient(circle at 20% 10%, rgba(176, 92, 255, .45), transparent 45%),
                         radial-gradient(circle at 90% 90%, rgba(109, 93, 252, .5), transparent 50%), var(--sidebar-bg);
             color: #fff; padding: 48px 56px; display: flex; flex-direction: column; gap: 28px; }
.auth-side .brand { padding: 0; }
.auth-side h2 { font-size: 34px; line-height: 1.3; font-weight: 800; margin: auto 0 0; max-width: 460px; }
.auth-side ul { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 14px; }
.auth-side li { display: flex; align-items: center; gap: 12px; color: #d4d7f0; font-weight: 600; }
.auth-side li .ti { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: rgba(255, 255, 255, .08); font-size: 19px; color: #fff; }
.auth-main { display: flex; flex-direction: column; padding: 24px; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-card { width: 100%; max-width: 420px; margin: auto; }
.auth-card h1 { font-size: 28px; font-weight: 800; margin: 0 0 6px; }
.auth-card .lead { color: var(--muted); margin: 0 0 26px; }
.auth-card input[type=email], .auth-card input[type=password], .auth-card input[type=text] { padding: 12px 14px; font-size: 15px; }
.input-icon { position: relative; }
.input-icon .ti { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.input-icon input { padding-inline-start: 40px !important; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 11px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.alert-err { background: var(--err-bg); color: var(--err); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* user block in sidebar */
.user-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.user-box .who { min-width: 0; flex: 1; line-height: 1.25; }
.user-box .who b { display: block; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-box .who span { font-size: 12px; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.user-box .btn-icon { color: var(--sidebar-text); background: transparent; border: 0; }
.user-box .btn-icon:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 4px; }

@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { padding: 28px 22px; gap: 16px; }
    .auth-side h2 { font-size: 22px; margin: 0; }
    .auth-side ul { display: none; }
    .auth-main { padding: 20px 16px 40px; }
    .auth-card { margin: 10px auto; }
}
.danger-zone { border-color: color-mix(in srgb, var(--err) 35%, var(--border)); }

/* ---------- credits ---------- */
.cost-pill { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px;
             background: rgba(255, 255, 255, .22); font-size: 12px; font-weight: 800; }
.btn:not(.btn-primary) .cost-pill { background: rgba(242, 184, 75, .18); color: #b07800; }
html[data-theme="dark"] .btn:not(.btn-primary) .cost-pill { color: var(--gold); }
.cost-pill .ti { font-size: 13px; }
.nav-badge { margin-inline-start: auto; min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px;
             background: rgba(242, 184, 75, .18); color: var(--gold); font-size: 12px; font-weight: 800; }
.nav-badge.empty { background: var(--err-bg); color: var(--err); }
.flash-err { background: var(--err-bg); color: var(--err); }
.flash-warn { background: var(--warn-bg); color: var(--warn); flex-wrap: wrap; }
.flash-warn .btn { color: inherit; }
.flash-err a { color: inherit; font-weight: 800; text-decoration: underline; margin-inline-start: 6px; }
.wallet-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.wallet-hero .big { font-size: 46px; font-weight: 900; line-height: 1; }
.wallet-hero .coin { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 32px;
                     background: linear-gradient(135deg, #f7d27a, #e0a63a); color: #5a3a00; box-shadow: 0 10px 24px rgba(224, 166, 58, .35); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.price-item { border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; align-items: center; gap: 12px; }
.price-item b { font-size: 20px; }
.amt-pos { color: var(--ok); font-weight: 800; }
.amt-neg { color: var(--err); font-weight: 800; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.pack { border: 1px solid var(--border); border-radius: 16px; padding: 18px; text-align: center; }
.pack .credits { font-size: 30px; font-weight: 900; }
.pack .price { color: var(--muted); margin: 4px 0 14px; }
.pack { position: relative; }
.pack.popular { border-color: var(--brand-1); box-shadow: 0 0 0 3px var(--ring); }
.pack .offer-badge { margin-bottom: 8px; }
.pack .bonus { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 800; font-size: 13px; margin-top: 2px; }
.pack .price { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; }
.pack .price b { color: var(--text); }

/* ---------- youtube ---------- */
.channel-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.channel-avatar.ph { display: grid; place-items: center; background: #ff000014; color: #e00; font-size: 26px; }
.yt-red { color: #e00 !important; }
.publish-box .yt-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }

/* ---------- social platforms ---------- */
.pf-youtube { --pf: #ff0033; }
.pf-tiktok { --pf: #111; }
.pf-instagram { --pf: #d62976; }
.pf-facebook { --pf: #1877f2; }
.pf-meta { --pf: #0866ff; }
html[data-theme="dark"] .pf-tiktok { --pf: #e9e9ef; }
.connect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.connect-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.connect-card.off { opacity: .75; }
.pf-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; flex: none;
           color: var(--pf); background: color-mix(in srgb, var(--pf) 12%, transparent); }
.avatar-wrap { position: relative; width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--surface-2); }
.avatar-wrap .channel-avatar { position: absolute; inset: 0; }
.pf-dot { position: absolute; inset-inline-end: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
          font-size: 14px; color: #fff; background: var(--pf); border: 2px solid var(--surface); }
.pub-list { display: grid; gap: 8px; margin-bottom: 12px; }
.pub-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; }
.pub-item .pf-icon { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
.pub-item .grow { flex: 1; min-width: 0; }
.pub-badges { display: inline-flex; gap: 4px; margin-inline-start: 4px; }
.pub-badges a, .pub-badges span { color: var(--pf); font-size: 16px; }
.target-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 12px; }
.target-list .check { margin: 0; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.legal { max-width: 820px; margin: 0 auto; line-height: 1.9; }
.legal h2 { margin-top: 28px; }

/* ---------- الدخول بـ Google / Facebook ---------- */
.ext-logins { display: grid; gap: 10px; margin-bottom: 4px; }
.ext-logins form { margin: 0; }
.ext-btn { padding: 11px; font-weight: 700; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.ext-btn:hover { border-color: var(--brand-1); }
.ext-btn .ti { font-size: 20px; }
.ext-google .ti { color: #ea4335; }
.ext-facebook .ti { color: #1877f2; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.linked-list { display: grid; gap: 10px; }
.linked-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.linked-row .ti { font-size: 22px; }
.linked-row .grow { flex: 1; min-width: 0; }

/* =====================================================================
   الصفحة التعريفية (Landing) — للزوّار غير المسجّلين
   ===================================================================== */
.lp-body { background: var(--bg); }
.lp-wrap { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
.lp-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.lp-nav-in { display: flex; align-items: center; gap: 18px; height: 64px; }
.lp-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; }
.lp-brand:hover { text-decoration: none; }
.lp-brand .brand-logo { width: 34px; height: 34px; font-size: 18px; }
.lp-links { display: flex; gap: 22px; margin-inline-start: 18px; }
.lp-links a { color: var(--text-2); font-weight: 600; font-size: 14px; }
.lp-links a:hover { color: var(--brand-1); text-decoration: none; }
.lp-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }

.lp-hero { padding: 64px 0 40px; background: radial-gradient(1100px 480px at 85% -10%, color-mix(in srgb, var(--brand-2) 18%, transparent), transparent 70%), radial-gradient(800px 420px at 0% 10%, color-mix(in srgb, var(--brand-1) 14%, transparent), transparent 70%); }
.lp-hero-in { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.lp-eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--brand-1); }
.lp-hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.15; margin: 18px 0 14px; font-weight: 900; letter-spacing: -.5px; }
.lp-grad { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { font-size: 18px; color: var(--text-2); max-width: 560px; margin: 0 0 24px; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.lp-btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.lp-note { margin: 12px 0 0; display: flex; align-items: center; gap: 6px; }
.lp-platforms { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 28px; color: var(--muted); font-size: 13px; font-weight: 700; }
.lp-platforms span { display: inline-flex; align-items: center; gap: 5px; }
.lp-platforms .ti { font-size: 18px; }

.lp-hero-art { position: relative; display: flex; justify-content: center; min-height: 440px; }
.lp-phone { width: 230px; height: 440px; border-radius: 36px; padding: 10px; background: #0d1024; box-shadow: 0 30px 70px rgba(30, 20, 90, .35); }
.lp-phone-screen { position: relative; height: 100%; border-radius: 28px; overflow: hidden; background: #1b1f3c; }
.lp-scene { position: absolute; inset: 0; background: radial-gradient(circle at 70% 25%, #ffd08a 0 9%, transparent 10%), linear-gradient(180deg, #f6a35b 0%, #c4576b 38%, #3b2a63 64%, #141633 100%); }
.lp-scene::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: 0; height: 42%; background: radial-gradient(60% 70% at 30% 100%, #0e1029 0 60%, transparent 61%), radial-gradient(55% 60% at 80% 100%, #15183a 0 60%, transparent 61%); }
.lp-sub { position: absolute; left: 14px; right: 14px; bottom: 58px; text-align: center; color: #fff; font-weight: 800; font-size: 15px; line-height: 1.5; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.lp-progress { position: absolute; left: 16px; right: 16px; bottom: 22px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.25); overflow: hidden; }
.lp-progress i { display: block; height: 100%; width: 40%; background: #fff; border-radius: 4px; animation: lp-prog 6s linear infinite; }
@keyframes lp-prog { from { width: 0; } to { width: 100%; } }
.lp-float { position: absolute; display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 700; font-size: 13px; white-space: nowrap; }
.lp-float .ti { font-size: 17px; color: var(--brand-1); }
.lp-float-1 { top: 40px; inset-inline-start: -4%; }
.lp-float-2 { top: 190px; inset-inline-end: -6%; }
.lp-float-3 { bottom: 50px; inset-inline-start: 0; }
.lp-float-3 .ti { color: #ff2b2b; }

.lp-section { padding: 72px 0; }
.lp-alt { background: var(--surface-2); border-block: 1px solid var(--border); }
.lp-h2 { text-align: center; font-size: clamp(26px, 3.4vw, 36px); font-weight: 900; margin: 0 0 10px; }
.lp-sub-h { text-align: center; color: var(--text-2); max-width: 640px; margin: 0 auto 30px; }
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
.lp-step { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.lp-step-n { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand-grad); color: #fff; font-weight: 900; }
.lp-step h3 { margin: 14px 0 6px; font-size: 18px; }
.lp-step p { margin: 0; color: var(--text-2); }
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 34px; }
.lp-feat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.lp-feat .ti { font-size: 26px; color: var(--brand-1); }
.lp-feat h3 { margin: 10px 0 6px; font-size: 17px; }
.lp-feat p { margin: 0; color: var(--text-2); font-size: 14px; }

.lp-styles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.lp-style { display: flex; flex-direction: column; gap: 6px; text-align: center; align-items: center; }
.lp-style-art { width: 100%; aspect-ratio: 9 / 14; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.lp-art-FreeStock { background: linear-gradient(160deg, #a9c8e8, #6b8fb3 55%, #3d5a7a); }
.lp-art-Auto { background: linear-gradient(160deg, #a9c8e8 0 50%, #c58cf0 50% 100%); }
.lp-art-AiGenerated { background: radial-gradient(circle at 65% 30%, #ffe08a 0 10%, transparent 11%), linear-gradient(170deg, #ff9a8b, #a56cf0 60%, #3a2c75); }
.lp-art-Motion { background: radial-gradient(circle at 30% 35%, #fff 0 7%, transparent 8%), radial-gradient(circle at 70% 60%, #ffd166 0 12%, transparent 13%), repeating-linear-gradient(135deg, #6d5dfc 0 14px, #8a7dff 14px 28px); }
.lp-art-AiVideo { background: linear-gradient(180deg, #f6a35b, #c4576b 45%, #3b2a63); position: relative; }
.lp-art-AiVideo::after { content: "\25B6"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 34px; text-shadow: 0 2px 10px rgba(0,0,0,.4); }

.lp-packs { max-width: 920px; margin: 0 auto; }
.pack .lp-price { font-size: 38px; line-height: 1.1; margin: 8px 0 6px; color: var(--text); }
.pack .lp-price s { font-size: 18px; margin-inline-end: 6px; }
.lp-price b { font-weight: 900; }
.lp-pack-list { list-style: none; padding: 0; margin: 14px 0 18px; text-align: start; font-size: 14px; color: var(--text-2); }
.lp-pack-list li { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0; }
.lp-pack-list .ti { color: var(--ok); margin-top: 3px; }

.lp-faq { max-width: 780px; }
.lp-faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-top: 10px; }
.lp-faq summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary::after { content: "+"; color: var(--brand-1); font-weight: 900; font-size: 20px; line-height: 1; }
.lp-faq details[open] summary::after { content: "\2212"; }
.lp-faq details p { margin: 10px 0 0; color: var(--text-2); }

.lp-final { padding: 70px 0; background: var(--brand-grad); color: #fff; }
.lp-final h2 { font-size: clamp(26px, 3.4vw, 36px); margin: 0 0 8px; font-weight: 900; }
.lp-final p { margin: 0 0 22px; opacity: .9; }
.lp-btn-white { background: #fff; color: #3b2bd6; border-color: #fff; font-weight: 800; }
.lp-btn-white:hover { background: #f1efff; }

.lp-footer { padding: 34px 0 26px; background: var(--surface); border-top: 1px solid var(--border); }
.lp-footer-in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 18px; }
.lp-footer-links { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; font-size: 14px; }
.lp-footer-links a { color: var(--text-2); }

@media (max-width: 940px) {
    .lp-hero-in { grid-template-columns: 1fr; }
    .lp-hero-art { min-height: 400px; }
    .lp-steps, .lp-features { grid-template-columns: 1fr 1fr; }
    .lp-styles { grid-template-columns: repeat(3, 1fr); }
    .lp-links { display: none; }
}
@media (max-width: 600px) {
    .lp-steps, .lp-features { grid-template-columns: 1fr; }
    .lp-styles { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin-inline: -16px; padding-inline: 16px; }
    .lp-style { flex: 0 0 42%; scroll-snap-align: start; }
    .lp-hide-sm { display: none; }
    .lp-hero { padding-top: 36px; }
    .lp-float-1, .lp-float-2 { display: none; }
}

/* ---------- Admin: نصوص الموقع ---------- */
.sc-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 12px; position: sticky; top: 8px; z-index: 5; }
.sc-search { flex: 1; min-width: 220px; position: relative; }
.sc-search .ti { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.sc-search input { padding-inline-start: 36px; margin: 0; }
.sc-only { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.sc-only input { width: auto; margin: 0; }
.sc-groups { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.sc-groups a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text-2); font-size: 13.5px; }
.sc-groups a:hover { border-color: var(--brand-1); color: var(--brand-1); }
.sc-groups b { background: var(--brand-1); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.sc-group { margin-bottom: 18px; scroll-margin-top: 90px; }
.sc-group.is-dirty { border-color: var(--brand-1); }
.sc-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sc-group-head .card-title { margin: 0; }
.sc-group-actions { display: flex; gap: 8px; }
.sc-group-foot { display: flex; justify-content: flex-end; padding-top: 12px; }
.sc-row { padding: 14px 0; border-top: 1px solid var(--border); }
.sc-row.is-changed { box-shadow: inset 3px 0 0 var(--brand-1); padding-inline-start: 12px; }
[dir="rtl"] .sc-row.is-changed { box-shadow: inset -3px 0 0 var(--brand-1); }
.sc-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 14.5px; }
.sc-mini { font-size: 11px; padding: 1px 8px; }
.sc-reset { margin-inline-start: auto; }
.sc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sc-pair input, .sc-pair textarea { margin: 2px 0 0; width: 100%; }
.sc-pair textarea { min-height: 76px; }
.sc-icon { display: flex; align-items: center; gap: 10px; max-width: 360px; }
.sc-icon input { margin: 0; }
@media (max-width: 760px) { .sc-pair { grid-template-columns: 1fr; } }

/* شريط معاينة المدير فوق الصفحة العامة */
.lp-preview-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 14px; background: #fff7e0; color: #7a5600; font-size: 14px; font-weight: 600; border-bottom: 1px solid #f1d58a; }
[data-theme="dark"] .lp-preview-bar { background: #3a2f12; color: #f6d68a; border-color: #5c4a1a; }

/* ---------- شريط الموقع داخل التطبيق (بعد تسجيل الدخول) ---------- */
.site-bar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 22px; height: 60px; padding: 0 36px;
    background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-bar-home { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); font-size: 14.5px; }
.site-bar-home .ti { color: var(--brand-1); }
.site-bar-links { display: flex; gap: 22px; }
.site-bar-links a, .site-bar-home:hover { color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none; }
.site-bar-links a:hover { color: var(--brand-1); }
.site-bar-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.lp-avatar { width: 34px; height: 34px; font-size: 13px; text-decoration: none; }
@media (max-width: 900px) {
    /* على الموبايل في شريط علوي أصلاً: الروابط بتنزل تحته وبتنسحب بالعرض */
    .site-bar { top: auto; position: static; height: auto; padding: 8px 16px; gap: 12px; overflow-x: auto; white-space: nowrap; }
    .site-bar-home, .site-bar-actions { display: none; }
    .site-bar-links { gap: 18px; }
}
.lp-section { scroll-margin-top: 70px; }   /* العنوان ما يختفي تحت الشريط لما تفتح #pricing */

/* ---------- الاشتراك الشهري ---------- */
.wallet-buckets { display: flex; flex-wrap: wrap; gap: 14px 28px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.wallet-buckets .bucket { display: flex; gap: 10px; align-items: center; }
.wallet-buckets .bucket b { font-size: 20px; }
.sub-card { border-color: color-mix(in srgb, var(--brand-1) 35%, var(--border)); }
.sub-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
.sub-head h2 { font-size: 22px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sub-price { font-size: 18px; color: var(--brand-1); font-weight: 800; }
.sub-actions { display: flex; gap: 8px; }
.sub-meter { height: 8px; border-radius: 99px; background: var(--surface-2, rgba(0,0,0,.06)); overflow: hidden; margin-bottom: 6px; }
.sub-meter i { display: block; height: 100%; background: var(--brand-grad); border-radius: inherit; }
.pack.plan.current { border-color: var(--brand-1); box-shadow: 0 0 0 1px var(--brand-1); }
.plan-price b { font-size: 26px; }
.plan .lp-pack-list .ti-coin { color: var(--gold); }
.user-sub { display: flex; align-items: center; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.user-sub-form { display: inline-flex; gap: 2px; align-items: center; }
.user-sub-form select { padding: 3px 6px; font-size: 12px; height: 28px; width: auto; max-width: 150px; margin: 0; }
.lp-h3 { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 20px; margin: 0 0 16px; }
.lp-h3 .ti { color: var(--brand-1); }
.lp-per { font-size: 15px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.pay-busy[hidden] { display: none; }
.pay-busy { position: fixed; inset: 0; z-index: 10000; background: rgba(10,10,25,.45); display: grid; place-items: center; }
.pay-busy .card { display: flex; align-items: center; gap: 12px; padding: 18px 26px; font-weight: 700; }
.pay-busy .ti { font-size: 22px; color: var(--brand-1); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 1s linear infinite; }
.sc-pair textarea.sc-md { min-height: 420px; font-size: 14px; line-height: 1.7; font-family: inherit; }
.legal-body h2 { margin-top: 26px; }
.legal-body ul { padding-inline-start: 22px; }
.legal-body li { margin-bottom: 6px; }

/* ---------- المفاتيح والإعدادات ---------- */
.set-row { padding: 14px 0; border-top: 1px solid var(--border); position: relative; }
.set-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.set-head code { background: var(--surface-2, rgba(0,0,0,.04)); padding: 1px 6px; border-radius: 6px; }
.set-input { max-width: 640px; }
.set-input input, .set-input select { margin: 0; width: 100%; }
.set-secret { display: flex; gap: 10px; align-items: center; }
.set-current { flex: 0 0 auto; min-width: 150px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--text-2);
    background: var(--surface-2, rgba(0,0,0,.04)); padding: 9px 12px; border-radius: 10px; border: 1px dashed var(--border); }
.set-remove { position: absolute; top: 10px; inset-inline-end: 0; }
.sc-groups b.warn { background: #e5484d; }
@media (max-width: 760px) { .set-secret { flex-direction: column; align-items: stretch; } .set-remove { position: static; margin-top: 8px; } }

/* ---------- لوحة أرصدة المزوّدين ---------- */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.bal-card { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 90px; border-top: 3px solid var(--border); }
.bal-card.bal-ok { border-top-color: var(--ok); }
.bal-card.bal-low { border-top-color: var(--warn); }
.bal-card.bal-empty, .bal-card.bal-error { border-top-color: var(--err); }
.bal-head { display: flex; align-items: center; gap: 10px; }
.bal-head b { font-size: 16px; }
.bal-big { font-size: 30px; font-weight: 800; line-height: 1.15; text-align: start; }
.bal-low .bal-big { color: var(--warn); }
.bal-empty .bal-big { color: var(--err); }
.bal-sub { color: var(--text-2); font-size: 13.5px; }
.bal-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bal-bar span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.bal-low .bal-bar span { background: var(--warn); }
.bal-empty .bal-bar span { background: var(--err); }
.bal-err { color: var(--err); word-break: break-word; }
.bal-known { margin-top: 4px; }
.bal-known-row { display: flex; gap: 8px; align-items: center; }
.bal-known-row input { margin: 0; max-width: 130px; }
.bal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.bal-settings { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.bal-settings label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; }
.bal-settings input { margin: 0; width: 180px; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); margin-inline-start: auto; }

/* ---------- قوالب السلاسل ---------- */
.tpl-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tpl-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.tpl-chip:hover { border-color: var(--brand-1); color: var(--brand-1); }
.tpl-chip.active { background: var(--brand-grad); border-color: transparent; color: #fff; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tpl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(17, 20, 43, .12); }
.tpl-card[hidden] { display: none; }
.tpl-media { position: relative; aspect-ratio: 9 / 12; display: grid; place-items: center; overflow: hidden; color: #fff; cursor: pointer;
             background: linear-gradient(160deg, #2a2160, #6d5dfc 60%, #b05cff); }
.tpl-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tpl-icon { font-size: 64px; opacity: .9; filter: drop-shadow(0 6px 18px rgba(0,0,0,.25)); }
.tpl-play { position: absolute; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); font-size: 24px; transition: opacity .2s; }
.tpl-media.playing .tpl-play { opacity: 0; }
.tpl-lang { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(0,0,0,.45); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .5px; }
.tpl-cat-stories { background: linear-gradient(160deg, #120f24, #3b1d5e 55%, #8a2c6b); }
.tpl-cat-history { background: linear-gradient(160deg, #2b1a0b, #8a5a22 55%, #d9a441); }
.tpl-cat-facts { background: linear-gradient(160deg, #06303a, #0f8f8f 55%, #4fd1c5); }
.tpl-cat-motivation { background: linear-gradient(160deg, #2b0f0f, #b2412b 55%, #f08a4b); }
.tpl-cat-science { background: linear-gradient(160deg, #050a24, #1d3b8a 55%, #5b7cfa); }
.tpl-cat-kids { background: linear-gradient(160deg, #3a1d5e, #e07ab8 55%, #ffd27a); }
.tpl-cat-money { background: linear-gradient(160deg, #0b2a1b, #1f8a55 55%, #7bd88f); }
.tpl-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tpl-body h3 { margin: 0; font-size: 17px; }
.tpl-body p { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.6; flex: 1; }
.tpl-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.tpl-banner-link { color: inherit; text-decoration: none; border: 1px dashed var(--brand-1); }
.tpl-banner-link:hover { text-decoration: none; background: rgba(109, 93, 252, .05); }
@media (max-width: 560px) { .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tpl-body { padding: 12px; } .tpl-body p { display: none; } .tpl-icon { font-size: 44px; } }
.tpl-body .btn { margin-top: auto; }
.lp-section .tpl-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 270px)); justify-content: center; }
@media (max-width: 560px) { .lp-section .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tplr-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; line-height: 1.7; }
.tplr-chars { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; }
.tplr-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tplr-videos figure { margin: 0; }
.tplr-videos video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 12px; }
.tplr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tplr-actions form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.tplr-actions textarea { width: 100%; }
@media (max-width: 760px) { .tplr-actions { grid-template-columns: 1fr; } }

/* ---------- اقتراح تصحيح الإيميل ---------- */
.email-hint { margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.email-hint[hidden] { display: none; }
.email-hint button { border: 0; background: none; font: inherit; cursor: pointer; padding: 0; }
.email-hint-use { color: var(--brand-1); text-decoration: underline; font-weight: 800; }
.email-hint-keep { margin-inline-start: auto; color: var(--text-2); font-size: 12.5px; text-decoration: underline; }
.email-hint.shake { animation: hint-shake .4s; }
@keyframes hint-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.tplr-reward { gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.tplr-reward input { width: 110px; margin: 0; }
.tplr-reward .hint { flex-basis: 100%; margin: 0; }
.tplr-gift { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: rgba(242, 184, 75, .16); color: #b07800; font-weight: 700; font-size: 14px; }
html[data-theme="dark"] .tplr-gift { color: var(--gold); }
.tplr-gift .ti { font-size: 20px; }

/* ---------- تحويل صورة الشخصية لنمط ---------- */
.char-stylize { margin-top: 14px; border: 1px dashed var(--brand-1); border-radius: 12px; padding: 10px 14px; background: rgba(109, 93, 252, .04); }
.char-stylize summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--brand-1); }
.char-stylize[open] summary { margin-bottom: 10px; }
.st-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.st-opt input { position: absolute; opacity: 0; pointer-events: none; }
.st-opt span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.st-opt input:checked + span { background: var(--brand-grad); color: #fff; border-color: transparent; }
.st-opt input:focus-visible + span { outline: 2px solid var(--brand-1); outline-offset: 2px; }
.st-custom { margin: 10px 0 0; }
.st-custom[hidden] { display: none; }
.char-orig { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.char-orig img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.error-box.error-friendly { white-space: normal; direction: inherit; text-align: start; font-size: 14px; font-weight: 600; }
.err-admin { margin-top: 10px; padding-top: 10px; border-top: 1px dashed currentColor; font-weight: 400; font-size: 12.5px; }
.err-admin summary { cursor: pointer; }
.err-admin div { margin-top: 6px; word-break: break-word; text-align: left; white-space: pre-wrap; }

/* ---------- حاسبة الهامش ---------- */
.margin-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; margin-top: 12px; }
.margin-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.margin-form input { margin: 0; }
.wm-note { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(242, 184, 75, .14); color: inherit; font-size: 13px; text-decoration: none; }
.wm-note:hover { background: rgba(242, 184, 75, .22); text-decoration: none; }
.wm-note span { flex: 1; }

/* ---------- شهري / سنوي ---------- */
.period-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); margin: 0 0 18px; }
.period-toggle button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 700; padding: 8px 16px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.period-toggle button.on { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(17, 20, 43, .1); }
.period-toggle button b { font-size: 11.5px; background: rgba(34, 160, 107, .14); color: var(--ok); padding: 2px 8px; border-radius: 999px; }
.plans-grid .when-yearly { display: none; }
.plans-grid.show-yearly .when-yearly { display: block; }
.plans-grid.show-yearly .when-monthly { display: none; }
.period-hint .when-yearly { display: none; }
.period-hint.show-yearly .when-yearly { display: inline; }
.period-hint.show-yearly .when-monthly { display: none; }
.yearly-note { margin: -4px 0 10px; color: var(--text-2); }
.yearly-note b { color: var(--ok); }
.lp-period { text-align: center; }

/* ---------- شريط عرض الإطلاق ---------- */
.offer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 10px 16px; background: linear-gradient(90deg, #6d5dfc, #b05cff); color: #fff; font-size: 14px; font-weight: 600; text-align: center; }
.offer-bar code { background: rgba(255,255,255,.18); border: 1px dashed rgba(255,255,255,.6); padding: 2px 10px; border-radius: 8px; font-weight: 800; letter-spacing: 1px; font-size: 14px; color: #fff; }
.offer-bar .offer-end { opacity: .85; font-weight: 500; }
.offer-bar a { color: #fff; text-decoration: underline; font-weight: 800; }
.content .offer-bar { border-radius: var(--radius); margin-bottom: 18px; }

/* ---- تكلفة الفيديوهات ---- */
.vc-filters { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 18px; }
.vc-filters .chip { display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:999px; border:1px solid var(--border); background:var(--surface); color:var(--text); font-size:.9rem; text-decoration:none; }
.vc-filters .chip.active { border-color:var(--brand-1); color:var(--brand-1); background:color-mix(in srgb, var(--brand-1) 8%, transparent); }
.vc-filters .chip a { color:inherit; }
.vc-ok { color:var(--ok, #16a34a); font-weight:700; }
.vc-warn { color:var(--warn, #d97706); font-weight:700; }
.vc-bad { color:var(--err); font-weight:700; }

/* ---- اختيار الصوت ---- */
.voice-picker .vp-tools { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 10px; align-items:center; }
.voice-picker .vp-tools select, .voice-picker .vp-tools input[type=search] { flex:1 1 180px; min-width:0; }
.vp-gender { display:inline-flex; border:1px solid var(--border); border-radius:999px; overflow:hidden; }
.vp-gender button { border:0; background:transparent; padding:7px 14px; font:inherit; color:var(--text); cursor:pointer; display:inline-flex; gap:4px; align-items:center; }
.vp-gender button.active { background:var(--brand-1); color:#fff; }
.vp-list { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:8px; max-height:380px; overflow:auto; padding:2px; }
.vp-item { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--border); border-radius:14px; background:var(--surface); cursor:pointer; transition:border-color .15s, box-shadow .15s; }
.vp-item:hover { border-color:color-mix(in srgb, var(--brand-1) 50%, var(--border)); }
.vp-item.selected { border-color:var(--brand-1); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand-1) 18%, transparent); }
.vp-item .vp-text { flex:1; min-width:0; display:flex; flex-direction:column; }
.vp-item .vp-text b { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.vp-item .vp-text span { font-size:.82rem; color:var(--muted); }
.vp-item .vp-check { color:var(--brand-1); font-size:1.25rem; visibility:hidden; }
.vp-item.selected .vp-check { visibility:visible; }
.vp-play { flex:none; width:38px; height:38px; border-radius:50%; border:0; background:color-mix(in srgb, var(--brand-1) 12%, transparent); color:var(--brand-1); cursor:pointer; display:grid; place-items:center; font-size:1.05rem; }
.vp-play.playing { background:var(--brand-1); color:#fff; }
.vp-play.loading i { animation:spin 1s linear infinite; }
.vp-empty { grid-column:1/-1; text-align:center; padding:16px; }
@keyframes spin { to { transform:rotate(360deg); } }
.vp-item[hidden] { display:none; }

/* ترقيم صفحات الجداول (table-pager.js) */
.rtable tr[hidden] { display: none !important; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 2px 0; }
.pager-info { color: var(--muted); font-size: 13px; }
.pager-pages { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-btn { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .12s, border-color .12s; }
.pager-btn:hover:not(:disabled) { border-color: var(--brand-1); }
.pager-btn.active { background: var(--brand-1); border-color: var(--brand-1); color: #fff; }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-dots { color: var(--muted); padding: 0 2px; }
