/* ألوان reCreation (نفس recreationagency.dev): أسود #10110e، ليموني #dfff14، فاتح #f3f3e9 */
:root {
  --bg: #10110e;
  --surface: #181914;
  --surface-2: #20211b;
  --ink: #f3f3e9;
  --muted: #a8aa9c;
  --line: #34362f;
  --accent: #dfff14;
  --accent-ink: #10110e;
  --ok: #6ee7a0;
  --warn: #ffd36b;
  --bad: #ff7a6e;
  --fb: #1877f2;
  --ig: #d62976;
  --tt: #f3f3e9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Cairo', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; }
a { color: inherit; }
h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
code { background: rgba(127,127,127,.15); padding: 1px 6px; border-radius: 4px; font-size: 13px; direction: ltr; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bad { color: var(--bad) !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
[hidden] { display: none !important; }

/* ── الهيدر ── */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; color: var(--muted); font-size: 13px; }
.brand img { height: 28px; }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#nav a { padding: 6px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--muted); white-space: nowrap; }
#nav a:hover { color: var(--ink); background: var(--surface-2); }
#nav a.active { background: var(--accent); color: var(--accent-ink); }
.user { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }

main { padding: 20px 24px 60px; max-width: 1500px; margin: 0 auto; }

/* ── أزرار وفورم ── */
.btn { font: inherit; font-weight: 700; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.icon { width: 36px; justify-content: center; padding: 6px 0; }
.btn.block { width: 100%; justify-content: center; }
.btn.danger { color: var(--bad); }
.btn.fb { background: var(--fb); border-color: var(--fb); color: #fff; }
.btn.tt { background: #111; border-color: #111; color: #fff; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=color] { padding: 2px; height: 40px; }
input[type=datetime-local] { direction: ltr; text-align: right; }
select { width: auto; min-width: 160px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
label select { width: 100%; }
.lbl { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.lrow { display: flex; justify-content: space-between; }
textarea { resize: vertical; line-height: 1.7; }
.form { display: flex; flex-direction: column; gap: 14px; }

/* ── بانرات ── */
.banner { padding: 10px 16px; border-radius: 10px; margin-bottom: 10px; font-size: 14px; }
#banner .banner { border-radius: 0; margin: 0; text-align: center; }
.banner.warn { background: #3a2f10; color: #ffdf8a; }
.banner.info { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
#banner .banner.warn { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ── شارات ── */
.pb { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px; font-size: 10px; font-weight: 800; color: #fff; font-family: system-ui, sans-serif; line-height: 1; }
.pb.facebook { background: var(--fb); font-size: 13px; }
.pb.instagram { background: linear-gradient(45deg, #feda75, #d62976 50%, #4f5bd5); }
.pb.tiktok { background: #000; box-shadow: inset 2px 0 0 #25f4ee, inset -2px 0 0 #fe2c55; }
.st { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-scheduled { background: #2f3608; color: var(--accent); }
.st-publishing, .st-pending { background: #3a2f10; color: #ffd36b; }
.st-published, .st-done { background: #12301f; color: #6ee7a0; }
.st-partial { background: #3a2410; color: #fdba74; }
.st-failed { background: #3b1513; color: #ff8a80; }
.tg { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border-radius: 8px; background: var(--surface-2); font-size: 12px; font-weight: 600; }
.tg.t-failed { background: #3b1513; color: var(--bad); }
.tg.t-done { opacity: .75; }

/* ── التولبار ── */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.month-title { min-width: 150px; text-align: center; }
.stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); font-weight: 600; margin-inline-end: 8px; }
.tabs { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 5px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); }

/* ── التقويم ── */
.cal-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); background: var(--line); gap: 1px; min-width: 840px; }
.wd { background: var(--surface); padding: 8px; text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.cell { background: var(--surface); min-height: 118px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.cell:hover { background: color-mix(in srgb, var(--surface) 92%, var(--accent)); }
.cell.out { background: var(--bg); }
.cell.out .dnum { opacity: .4; }
.dnum { font-size: 13px; font-weight: 700; color: var(--muted); }
.cell.today .dnum { background: var(--accent); color: var(--accent-ink); border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.chip { display: flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--cc); border-radius: 8px; padding: 3px 5px; font-size: 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.chip:hover { border-color: var(--ink); border-inline-start-color: var(--cc); }
.chip img, .chip .vid { width: 30px; height: 30px; border-radius: 5px; object-fit: cover; flex: none; }
.chip .vid { display: grid; place-items: center; background: #222; color: #fff; font-size: 10px; }
.chip-body { min-width: 0; flex: 1; }
.chip-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.chip-top .ps { display: flex; gap: 2px; }
.chip-top .pb { min-width: 15px; height: 15px; font-size: 8px; border-radius: 4px; }
.chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.chip.s-published { opacity: .7; }
.chip.s-failed, .chip.s-partial { background: #3b1513; }
.chip.s-draft { border-style: dashed; }

/* ── قائمة البوستات ── */
.plist { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; cursor: pointer; }
.prow:hover { border-color: var(--ink); }
.pthumb { position: relative; width: 72px; height: 72px; flex: none; border-radius: 8px; overflow: hidden; background: var(--bg); display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.pthumb img, .pthumb video { width: 100%; height: 100%; object-fit: cover; }
.pthumb i { position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,.7); color: #fff; font-style: normal; font-size: 11px; padding: 0 6px; border-radius: 6px; }
.pmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pmeta { display: flex; gap: 8px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pcap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.ptargets { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── الكروت ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--cc); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 8px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--cc); }
.card p { margin: 0; }
.accs { display: flex; flex-wrap: wrap; gap: 6px; }
.card-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.card-stats b { color: var(--ink); font-size: 16px; }

/* ── الجداول ── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 13px; color: var(--muted); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.unassigned { background: color-mix(in srgb, var(--surface) 90%, #ffc400); }
.acc { display: flex; align-items: center; gap: 10px; }
.acc img, .noav { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg); flex: none; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }

/* ── المودال ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(1000px, 100%); }
.mh { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.mh h3 { display: flex; gap: 10px; align-items: center; }
.x { font-size: 24px; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.mb { padding: 18px 20px; overflow-y: auto; }
.mf { display: flex; justify-content: space-between; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

.ed { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.ed-main, .ed-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.mthumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); }
.mthumb img, .mthumb video { width: 100%; height: 100%; object-fit: cover; }
.vtag { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 6px; }
.mtools { position: absolute; bottom: 4px; left: 4px; display: flex; gap: 3px; }
.mtools button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; align-items: center; font-weight: 400; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--surface) 94%, var(--accent)); }
.drop b { color: var(--accent); }
.prog { width: 100%; height: 6px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.targets { display: flex; flex-direction: column; gap: 6px; }
.tgt { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; }
.tgt input { width: auto; accent-color: var(--accent); }
.tgt img { width: 24px; height: 24px; border-radius: 50%; }
.tgt.on { border-color: var(--accent); background: color-mix(in srgb, var(--surface) 94%, var(--accent)); }
.tgt span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { padding: 12px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.results { display: flex; flex-direction: column; gap: 8px; }
.res { padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.res-err { color: var(--bad); direction: auto; word-break: break-word; }
.res a { color: var(--accent); font-weight: 600; }

/* ── التوست ── */
#toasts { position: fixed; bottom: 20px; left: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); animation: fade .2s; }
.toast.err { background: var(--bad); color: #fff; }

/* ── تسجيل الدخول ── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); padding: 32px; border-radius: 18px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-card p { margin: -8px 0 4px; }
.login-logo { height: 44px; align-self: center; margin-bottom: 4px; }
.login-card h2 { color: var(--accent); }
.login-card a { color: var(--accent); }
.login-page { background: radial-gradient(1200px 600px at 50% -10%, #1d2008, var(--bg)); }
.err { color: var(--bad); font-weight: 600; min-height: 1em; }

/* ── موبايل ── */
@media (max-width: 800px) {
  .top { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  #nav { order: 3; flex-basis: 100%; }
  main { padding: 16px 16px 60px; }
  .ed { grid-template-columns: 1fr; }
  .prow { align-items: flex-start; }
  .pthumb { width: 56px; height: 56px; }
}
