:root {
  --brand: #465fff; --brand-600: #3641f5; --brand-50: #ecf3ff;
  --ink: #101828; --muted: #475467; --faint: #98a2b3; --line: #e4e7ec; --wash: #f5f6f8; --card: #fff;
  --grey: #667085; --grey-bg: #f2f4f7;
  --amber: #b54708; --amber-bg: #fef6e7;
  --blue: #175cd3; --blue-bg: #eaf2ff;
  --purple: #6927da; --purple-bg: #f4efff;
  --green: #067647; --green-bg: #e8f8ef;
  --red: #c01048; --red-bg: #fff0f3;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; overflow-x: clip; background: var(--wash); color: var(--ink); }
body { font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img, video { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
.boot { display: grid; place-items: center; min-height: 100dvh; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.94); } }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 10px; height: 58px; }
.top .logo { height: 26px; width: auto; }
.top .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:active { background: var(--grey-bg); }
.pill-btn { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); background: #fff; }

/* hello */
.hello { padding: 18px 0 6px; }
.hello h1 { font-size: 22px; margin: 0; font-weight: 700; }
.hello p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

/* brand chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; margin: 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 6px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 14px; white-space: nowrap; }
[dir="ltr"] .chip { padding: 0 14px 0 6px; }
.chip.all { padding: 0 16px; }
.chip img, .chip .ph { width: 32px; height: 32px; border-radius: 50%; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.chip.on .badge { background: #ffb020; color: var(--ink); }

/* tabs */
.tabs { display: flex; gap: 4px; background: #eceef2; padding: 4px; border-radius: 14px; margin: 12px 0 14px; }
.tab { flex: 1; min-width: 0; white-space: nowrap; height: 38px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.tab .n { font-size: 12px; color: var(--faint); }

/* cards */
.list > * { min-width: 0; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-bottom: calc(110px + var(--safe-b)); }
.card { display: block; min-width: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16,24,40,.04); text-align: start; width: 100%; }
.card:active { transform: scale(.995); }
.card .media { position: relative; aspect-ratio: 4 / 5; background: #0b0d12; }
.card .media img, .card .media video { width: 100%; height: 100%; object-fit: cover; }
.card .media .tag { position: absolute; top: 12px; inset-inline-start: 12px; }
.card .media .play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.card .media .play span { width: 58px; height: 58px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; backdrop-filter: blur(4px); }
.card .media .count { position: absolute; bottom: 12px; inset-inline-end: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.card .body { padding: 12px 14px 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.brand-line { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; min-width: 0; }
.brand-line img { width: 26px; height: 26px; border-radius: 50%; object-fit: contain; border: 1px solid var(--line); background: #fff; flex: none; }
.brand-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { color: var(--muted); font-size: 14px; margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cap { margin: 8px 0 0; color: var(--ink); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.net { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 8px; background: var(--grey-bg); color: var(--muted); font-size: 12px; font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-pending { background: var(--amber-bg); color: var(--amber); }
.s-approved { background: var(--blue-bg); color: var(--blue); }
.s-scheduled { background: var(--purple-bg); color: var(--purple); }
.s-published { background: var(--green-bg); color: var(--green); }
.s-changes { background: var(--red-bg); color: var(--red); }
.s-withdrawn { background: var(--grey-bg); color: var(--grey); }
.ver { font-size: 12px; font-weight: 700; color: var(--brand-600); background: var(--brand-50); padding: 2px 8px; border-radius: 999px; }
.cmt { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 46px; }
.empty h3 { color: var(--ink); margin: 8px 0 4px; font-size: 18px; }

/* floating approve-all */
.fab-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 15; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--wash) 70%, rgba(245,246,248,0)); }
.fab-bar .wrap { padding: 0; }

/* buttons */
.btn { height: 52px; border-radius: 14px; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; width: 100%; }
.btn:disabled { opacity: .55; }
.btn-approve { background: #12b76a; color: #fff; box-shadow: 0 6px 16px rgba(18,183,106,.28); }
.btn-approve:active { background: #039855; }
.btn-change { background: #fff; color: var(--red); border: 1.5px solid #fecdd6; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-sm { height: 40px; font-size: 14px; border-radius: 11px; width: auto; }

/* detail */
.detail { padding-bottom: calc(120px + var(--safe-b)); }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: #0b0d12; }
.gallery::-webkit-scrollbar { display: none; }
.gallery > * { flex: none; width: 100%; scroll-snap-align: center; max-height: 78dvh; aspect-ratio: 4 / 5; object-fit: contain; background: #0b0d12; }
.gallery video { aspect-ratio: 9 / 16; }
.dots { display: flex; justify-content: center; gap: 6px; padding: 10px 0 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #d0d5dd; }
.dots i.on { background: var(--ink); width: 18px; border-radius: 4px; }
.section { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 14px 16px; margin-top: 12px; }
.section h4 { margin: 0 0 8px; font-size: 13px; color: var(--faint); font-weight: 600; letter-spacing: .02em; }
.caption { white-space: pre-wrap; font-size: 16px; margin: 0; }
.hashtags { color: var(--brand-600); font-size: 14px; margin-top: 8px; direction: ltr; text-align: start; word-break: break-word; }
.seg { display: inline-flex; background: var(--grey-bg); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.banner { border-radius: 14px; padding: 12px 14px; margin-top: 12px; font-size: 14.5px; display: flex; gap: 10px; align-items: flex-start; }
.banner b { display: block; font-size: 15px; }
.banner.ok { background: var(--blue-bg); color: #1849a9; }
.banner.done { background: var(--green-bg); color: var(--green); }
.banner.warn { background: var(--amber-bg); color: #93370d; }
.banner.bad { background: var(--red-bg); color: #a11043; }
.banner.info { background: var(--brand-50); color: #2a31d8; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; font-weight: 500; }

/* timeline */
.tl { display: grid; gap: 10px; }
.sys { text-align: center; font-size: 12.5px; color: var(--faint); }
.sys b { color: var(--muted); font-weight: 600; }
.bub { max-width: 86%; padding: 10px 12px; border-radius: 16px; font-size: 15px; }
.bub .who { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.bub .at { font-size: 11.5px; opacity: .7; margin-top: 4px; }
.bub p { margin: 0; white-space: pre-wrap; }
.bub.client { justify-self: start; background: #fff4e5; border-start-start-radius: 4px; }
.bub.client.changes { background: var(--red-bg); }
.bub.team { justify-self: end; background: var(--brand-50); border-start-end-radius: 4px; }
.bub .flag { display: inline-block; font-size: 11px; font-weight: 700; background: rgba(0,0,0,.06); padding: 1px 7px; border-radius: 6px; margin-bottom: 4px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(0,0,0,.06); }

/* action bar */
.action-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--safe-b)); }
.action-bar .wrap { padding: 0; display: flex; gap: 10px; }
.action-bar .btn { flex: 1; }
.action-bar .note { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 8px; }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 50; animation: fade .18s ease; }
.sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 51; background: #fff; border-radius: 22px 22px 0 0; max-height: 92dvh; overflow-y: auto; padding: 8px 18px calc(18px + var(--safe-b)); animation: up .22s cubic-bezier(.2,.8,.2,1); max-width: 640px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 5px; background: #d0d5dd; border-radius: 3px; margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; }
.sheet .sub { color: var(--muted); font-size: 14.5px; margin: 0 0 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
textarea.input { min-height: 120px; resize: vertical; }
.input { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px; background: #fff; outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
label.lbl { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 6px; color: var(--muted); }
.addphoto { display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border: 1.5px dashed #c5cad3; border-radius: 14px; color: var(--muted); font-weight: 600; margin-top: 10px; width: 100%; }
.picked { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.picked .ph { position: relative; width: 78px; height: 78px; border-radius: 12px; overflow: hidden; background: var(--grey-bg); }
.picked .ph img { width: 100%; height: 100%; object-fit: cover; }
.picked .ph .x { position: absolute; top: 4px; inset-inline-end: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; display: grid; place-items: center; }
.picked .ph.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.6) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="%23465fff" stroke-width="3" stroke-dasharray="40 20"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur=".8s" repeatCount="indefinite"/></circle></svg>') center no-repeat; }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.login .logo { height: 34px; width: auto; margin-bottom: 26px; }
.login h1 { font-size: 26px; margin: 0 0 6px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.err { color: var(--red); font-size: 14px; margin-top: 10px; }

/* admin */
.u-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.u-card .nm { font-weight: 700; }
.u-card .lg { color: var(--muted); font-size: 14px; direction: ltr; text-align: start; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.checks label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 14px; }
.checks input { width: 18px; height: 18px; accent-color: var(--brand); }
.copybox { background: var(--wash); border: 1px dashed var(--line); border-radius: 12px; padding: 10px; font-size: 13.5px; direction: ltr; word-break: break-all; margin-top: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; white-space: nowrap; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-height: 90dvh; border-radius: 10px; }

@media (min-width: 700px) {
  .list { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
}
