:root {
  --cocoa: #1c100a; --choc: #3a2115; --choc-2: #5b3624; --cream: #f8f1e7; --sand: #efe3d2;
  --bg: #faf7f2; --surface: #fff; --line: #e8ddcd; --line-2: #d8c8b2; --ink: #2b1a11; --muted: #7b6656;
  --gold: #c89b5c; --ok: #2f7a45; --ok-bg: #e6f2e9; --warn: #b5572e; --warn-bg: #fbeae2; --info: #2f6690; --info-bg: #e5eef6;
  --danger: #b3261e; --r: 12px;
  --font-d: "El Messiri", "Marcellus", serif; --font-b: "IBM Plex Sans Arabic", "Jost", system-ui, sans-serif;
}
* , *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:root[lang="en"] { --font-d: "Marcellus", serif; --font-b: "Jost", "IBM Plex Sans Arabic", system-ui, sans-serif; }
body { margin: 0; font: 400 15px/1.6 var(--font-b); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--font-d); font-weight: 500; margin: 0; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.2rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.logo-mark { display: block; width: 120px; aspect-ratio: 605/235; background: currentColor; -webkit-mask: url(../assets/logo-mask.png) center/contain no-repeat; mask: url(../assets/logo-mask.png) center/contain no-repeat; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font: 500 .9rem var(--font-b); cursor: pointer; text-decoration: none; color: inherit; background: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--choc); color: var(--cream); }
.btn-primary:hover { background: var(--choc-2); }
.btn-ghost { border-color: var(--line-2); background: var(--surface); }
.btn-ghost:hover { border-color: var(--choc-2); }
.btn-text { color: var(--muted); padding: 0 8px; }
.btn-text:hover { color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1e18; }
.btn-danger-ghost { color: var(--danger); border-color: #ecc9c5; background: var(--surface); }
.btn-danger-ghost:hover { border-color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .84rem; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sand); color: var(--ink); }
.link { color: var(--muted); font-size: .9rem; text-decoration: none; }
.link:hover { color: var(--ink); }

/* fields */
.field { display: grid; gap: 5px; }
.field > span { font-size: .84rem; font-weight: 500; }
input:not([type=checkbox]):not([type=file]), select { font: 400 .95rem var(--font-b); color: var(--ink); height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); width: 100%; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--choc-2); box-shadow: 0 0 0 3px rgba(200,155,92,.25); }
.invalid input, input.invalid { border-color: var(--danger); }
.err { color: var(--danger); font-size: .8rem; min-height: 0; }
.err:empty { display: none; }

/* gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--cocoa); }
.gate-card { width: min(380px, 100%); background: var(--cream); border-radius: 18px; padding: 32px 28px; display: grid; gap: 14px; }
.gate-card .logo-mark { color: var(--choc); width: 140px; }
.gate-card .btn { width: 100%; min-height: 46px; }
.gate-card .link { text-align: center; }

/* shell */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--cocoa); color: rgba(248,241,231,.75); display: flex; flex-direction: column; padding: 22px 14px; gap: 26px; }
.side-logo { display: flex; align-items: flex-end; gap: 8px; color: #e2c08a; text-decoration: none; padding: 0 8px; }
.side-logo .logo-mark { width: 104px; }
.side-logo small { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: rgba(248,241,231,.5); }
.side-nav { display: grid; gap: 4px; }
.side-nav button { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: 500 .93rem var(--font-b); cursor: pointer; text-align: start; }
.side-nav button:hover { background: rgba(248,241,231,.06); color: var(--cream); }
.side-nav button.active { background: rgba(200,155,92,.16); color: #f1d7aa; }
.side-foot { margin-top: auto; display: grid; gap: 6px; padding: 0 8px; }
.side-foot a, .side-foot button { color: rgba(248,241,231,.6); background: none; border: 0; padding: 6px 0; font: 400 .88rem var(--font-b); text-align: start; cursor: pointer; text-decoration: none; }
.side-foot a:hover, .side-foot button:hover { color: var(--cream); }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer; text-align: start; font: inherit; color: inherit; }
.stat:hover { border-color: var(--line-2); }
.stat.on { border-color: var(--choc); box-shadow: 0 0 0 1px var(--choc); }
.stat b { display: block; font: 400 1.6rem var(--font-d); }
.stat span { font-size: .82rem; color: var(--muted); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 200px; position: relative; display: block; }
.search svg { position: absolute; inset-inline-start: 12px; top: 12px; color: var(--muted); }
.search input { padding-inline-start: 38px !important; }
.sel { width: 200px; }

/* table */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fcfaf6; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fdfbf8; }
.c-img { width: 64px; } .c-price { width: 120px; } .c-act { width: 120px; }
.thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--sand); display: block; }
.pname { font-weight: 500; display: block; }
.pcat { font-size: .82rem; color: var(--muted); }
.price-in { width: 92px !important; height: 36px !important; text-align: right; font-variant-numeric: tabular-nums; font-family: "Jost", sans-serif; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: .74rem; font-weight: 500; background: var(--sand); color: var(--choc-2); white-space: nowrap; }
.pill.live { background: var(--ok-bg); color: var(--ok); }
.pill.upcoming { background: var(--info-bg); color: var(--info); }
.pill.expired, .pill.hidden { background: #eee8e1; color: #6f6258; }
.pill.limited { background: var(--warn-bg); color: var(--warn); }
.pill.live::before, .pill.upcoming::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sched-cell { font-size: .84rem; color: var(--muted); line-height: 1.35; }
.acts { display: flex; justify-content: flex-end; gap: 2px; }
.empty { padding: 48px 16px; text-align: center; display: grid; justify-items: center; gap: 8px; }
.empty p { margin: 0; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: grid; gap: 14px; max-width: 760px; }
.panel h2 { margin-top: 8px; }
.panel h2 small { font-family: var(--font-b); font-size: .8rem; }
.rep { display: grid; gap: 10px; }
.rep-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto auto; gap: 10px; align-items: end; }
.rep-row.email { grid-template-columns: 1fr 1fr 1.6fr auto; }
.rep-row .wa { display: flex; align-items: center; gap: 6px; height: 42px; font-size: .88rem; white-space: nowrap; }
.rep-empty { color: var(--muted); font-size: .9rem; margin: 0; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.panel > .btn { justify-self: start; }
.cards3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; gap: 24px; }
.cards3 > div { display: grid; gap: 8px; align-content: start; }
.cards3 p { margin: 0 0 6px; font-size: .9rem; }
.cards3 .btn { justify-self: start; }
.file-btn { cursor: pointer; }

/* drawer */
.drawer { margin: 0; margin-inline-start: auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); padding: 0; border: 0; background: var(--bg); color: var(--ink); box-shadow: -20px 0 50px rgba(0,0,0,.15); }
.drawer[open] { animation: drawerIn .28s cubic-bezier(.2,.7,.2,1); }
.drawer::backdrop { background: rgba(28,16,10,.4); }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
:root[dir="rtl"] .drawer { box-shadow: 20px 0 50px rgba(0,0,0,.15); }
:root[dir="rtl"] .drawer[open] { animation-name: drawerInR; }
@keyframes drawerInR { from { transform: translateX(-40px); opacity: 0; } }
.drawer form { height: 100%; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px 24px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.grow { flex: 1; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
legend { font: 400 1.05rem var(--font-d); padding: 0; margin-bottom: 10px; }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.media2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, background-color .15s; }
.drop.over { border-color: var(--gold); background: #fffaf2; }
.drop-prev { aspect-ratio: 4/3; background: var(--sand) center/cover; display: grid; place-items: center; color: var(--muted); font-size: .82rem; }
.drop-prev img, .drop-prev video { width: 100%; height: 100%; object-fit: cover; display: block; }
.drop-ui { padding: 10px 12px 12px; display: grid; gap: 2px; }
.drop-ui b { font-weight: 500; font-size: .9rem; }
.drop-ui small { font-size: .78rem; }
.drop-btns { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.tog { position: relative; }
.tog input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tog span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: .88rem; font-weight: 500; }
.tog input:checked + span { background: var(--choc); border-color: var(--choc); color: var(--cream); }
.tog input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; justify-self: start; position: relative; }
.switch input { position: absolute; opacity: 0; }
.sw { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background-color .15s; }
.sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .sw { background: var(--choc); }
.switch input:checked + .sw::after { transform: translateX(16px); }
:root[dir="rtl"] .switch input:checked + .sw::after { transform: translateX(-16px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--gold); outline-offset: 2px; }
.sched { display: grid; gap: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font: 500 .8rem var(--font-b); color: var(--choc-2); cursor: pointer; }
.quick button:hover { border-color: var(--choc-2); }
.quick .clr { color: var(--muted); }
.sched-sum { margin: 4px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--sand); font-size: .88rem; }

/* confirm + toast */
.confirm { width: min(420px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 24px; background: var(--surface); color: var(--ink); }
.confirm::backdrop { background: rgba(28,16,10,.45); }
.confirm h2 { margin-bottom: 8px; }
.cf-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--cocoa); color: var(--cream); padding: 12px 18px; border-radius: 12px; font-size: .9rem; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none; z-index: 10; display: flex; gap: 14px; align-items: center; }
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast button { background: none; border: 0; color: #e2c08a; font: 600 .88rem var(--font-b); cursor: pointer; }

/* responsive */
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cards3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; overflow-x: auto; }
  .side-logo small { display: none; } .side-logo .logo-mark { width: 80px; }
  .side-nav { display: flex; gap: 2px; }
  .side-nav button { height: 38px; padding: 0 10px; font-size: .86rem; white-space: nowrap; }
  .side-nav button svg { display: none; }
  .side-foot { display: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "img name act" "img price act" "pill pill pill" "sch sch sch"; gap: 4px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  .table td { padding: 0; border: 0; }
  .table td:nth-child(1) { grid-area: img; } .table td:nth-child(2) { grid-area: name; } .table td:nth-child(3) { grid-area: price; }
  .table td:nth-child(4) { grid-area: pill; } .table td:nth-child(5) { grid-area: sch; } .table td:nth-child(6) { grid-area: act; }
  .sel { width: calc(50% - 5px); }
  .rep-row, .rep-row.email { grid-template-columns: 1fr 1fr; }
  .lang-float { top: auto; bottom: 16px; }
  .row2, .media2 { grid-template-columns: 1fr; }
  .drawer-foot { flex-wrap: wrap; }
}

/* language button */
.lang-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 .88rem "Jost", "IBM Plex Sans Arabic", sans-serif; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
:root[lang="en"] .lang-btn { font-family: "IBM Plex Sans Arabic", sans-serif; }
.lang-btn:hover { border-color: var(--choc-2); }
.lang-btn svg { width: 16px; height: 16px; stroke-width: 1.7; }
.lang-float { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 20; }
.table td .pcat span[lang] { color: var(--muted); }
.in-app .lang-float { display: none; }
.side-lang { align-self: flex-start; margin-inline: 8px; background: transparent; color: rgba(248,241,231,.8); border-color: rgba(248,241,231,.25); box-shadow: none; }
.side-lang:hover { color: var(--cream); border-color: rgba(248,241,231,.6); }
@media (max-width: 820px) { .side-lang { margin: 0; margin-inline-start: auto; flex: none; } }
