/* =========================================================
   ZA Agency — Dashboard (RTL)
   ========================================================= */
@font-face {
  font-family: "Amin";
  src: url("../fonts/amin-regular.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #011726;
  --bg-2: #01203a;
  --surface: #062740;
  --surface-2: #0a3150;
  --border: rgba(255, 255, 255, .08);
  --border-2: rgba(255, 255, 255, .14);
  --text: #eaf1f6;
  --muted: #8ea4b5;
  --gold: #fbb03b;
  --gold-2: #ffc766;
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .28);
  --sidebar: 268px;
  --f-head: "Amin", "Segoe UI", Tahoma, sans-serif;
  --f-body: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(251, 176, 59, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(96, 165, 250, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text); font-family: var(--f-body); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 400; margin: 0; line-height: 1.25; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--gold); color: #03121e; }
.ic { flex: 0 0 auto; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; margin-top: 10px; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: 30;
  width: var(--sidebar);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #021f35 0%, #011726 100%);
  border-left: 1px solid var(--border);
  transition: transform .35s var(--ease);
}
.sb-brand { padding: 22px 22px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.sb-brand img { width: 96px; }
.sb-brand span { font-family: var(--f-head); color: var(--gold); font-size: 15px; padding: 3px 10px; border: 1px solid rgba(251, 176, 59, .35); border-radius: 999px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 10px 14px 20px; }
.sb-label { margin: 18px 10px 6px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.sb-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 3px; border-radius: 10px;
  color: #c9d6e0; position: relative;
  transition: background .25s, color .25s;
}
.sb-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sb-link.active { background: linear-gradient(90deg, rgba(251, 176, 59, .06), rgba(251, 176, 59, .16)); color: var(--gold); }
.sb-link.active::before { content: ""; position: absolute; right: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px 0 0 4px; background: var(--gold); box-shadow: 0 0 14px rgba(251, 176, 59, .7); }
.sb-badge { margin-inline-start: auto; background: var(--red); color: #fff; font-size: 11px; min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; font-weight: 700; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: rgba(0, 0, 0, .15); }
.sb-user .who { flex: 1; min-width: 0; }
.sb-user strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user small { color: var(--muted); font-size: 12px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #e78d12); color: #04131f;
  font-weight: 800; font-size: 14px; letter-spacing: .02em;
}
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.xs { width: 32px; height: 32px; font-size: 13px; background: var(--surface-2); color: var(--gold); border: 1px solid var(--border-2); }

/* ---------- Main ---------- */
.main { margin-right: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 30px;
  background: rgba(1, 23, 38, .82);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.tb-title { flex: 1; min-width: 0; }
.tb-title h1 { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.tb-actions { display: flex; align-items: center; gap: 10px; }
.tb-actions form { margin: 0; }
.icon-btn.menu-btn { display: none; }
.content { flex: 1; padding: 26px 30px 40px; max-width: 1400px; width: 100%; }
.adm-footer { padding: 16px 30px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform .2s var(--ease), background .25s, border-color .25s, box-shadow .25s, color .25s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #03121e; box-shadow: 0 8px 22px rgba(251, 176, 59, .25); }
.btn-primary:hover { box-shadow: 0 12px 28px rgba(251, 176, 59, .38); }
.btn-ghost { background: transparent; border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: var(--red); color: #1b0606; }
.btn-danger-ghost { background: transparent; border-color: rgba(248, 113, 113, .4); color: var(--red); }
.btn-danger-ghost:hover { background: rgba(248, 113, 113, .12); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; padding-block: 12px; margin-top: 8px; }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--border-2); color: #c9d6e0;
  transition: .25s var(--ease);
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(251, 176, 59, .08); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); background: rgba(248, 113, 113, .1); }
.link { color: var(--gold); font-size: 14px; }
.link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(10, 49, 80, .55), rgba(6, 39, 64, .55));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.card-head h2 .ic { color: var(--gold); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-2.wide-first { grid-template-columns: 1.6fr 1fr; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 { margin-bottom: 22px; }

/* stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card {
  display: flex; align-items: center; gap: 16px; padding: 20px;
  background: linear-gradient(135deg, rgba(10, 49, 80, .8), rgba(6, 39, 64, .5));
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.stat-card:hover { transform: translateY(-4px); border-color: rgba(251, 176, 59, .45); box-shadow: var(--shadow); }
.stat-card b { display: block; font-family: var(--f-head); font-size: 34px; line-height: 1; }
.stat-card small { color: var(--muted); }
.stat-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; }
.stat-ic.gold { background: rgba(251, 176, 59, .14); color: var(--gold); }
.stat-ic.blue { background: rgba(96, 165, 250, .14); color: var(--blue); }
.stat-ic.green { background: rgba(52, 211, 153, .14); color: var(--green); }
.stat-ic.red { background: rgba(248, 113, 113, .14); color: var(--red); }

/* section tiles */
.section-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.section-tile { position: relative; height: 140px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.section-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.section-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(1, 16, 28, .92), rgba(1, 16, 28, .1)); }
.section-tile .st-info { position: absolute; right: 14px; left: 14px; bottom: 12px; z-index: 1; }
.section-tile b { font-family: var(--f-head); font-size: 20px; display: block; }
.section-tile small { color: var(--gold); }
.section-tile em { color: var(--red); font-style: normal; }
.section-tile:hover img { transform: scale(1.08); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; transition: background .2s; }
.list-row:hover { background: rgba(255, 255, 255, .04); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row b { font-weight: 600; }
.list-row .line, .line { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row.unread b { color: var(--gold); }
.list-row.unread .avatar { border-color: var(--gold); }
.thumb { width: 52px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: 0 0 auto; }
.thumb.lg { width: 76px; height: 54px; }
.empty-mini { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .grow { flex: 1; min-width: 0; }
.timeline b { font-weight: 600; }

/* badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-green { background: rgba(52, 211, 153, .14); color: var(--green); }
.b-red { background: rgba(248, 113, 113, .14); color: var(--red); }
.b-blue { background: rgba(96, 165, 250, .14); color: var(--blue); }
.b-gold { background: rgba(251, 176, 59, .16); color: var(--gold); }
.b-gray { background: rgba(255, 255, 255, .08); color: var(--muted); }

/* ---------- Tables ---------- */
.table-card { padding: 6px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-weight: 600; font-size: 13px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.cell-project { display: flex; align-items: center; gap: 14px; }
.cell-project b { display: block; font-weight: 600; }
.cell-project small { display: block; font-size: 12px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.table form { margin: 0; }
.pill {
  padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--border-2); color: var(--muted);
  transition: .25s;
}
.pill.on { background: rgba(52, 211, 153, .15); border-color: rgba(52, 211, 153, .4); color: var(--green); }
.pill:hover { border-color: var(--gold); }
.star-btn { background: none; border: 0; color: #4a6477; padding: 6px; border-radius: 8px; transition: .25s; }
.star-btn.on { color: var(--gold); }
.star-btn.on svg { fill: var(--gold); }
.star-btn:hover { color: var(--gold); background: rgba(251, 176, 59, .1); }

.inline-edit-cell { padding: 8px 10px !important; }
.inline-edit { display: grid; grid-template-columns: 1.3fr 1.3fr 80px auto 40px; align-items: center; gap: 8px; }
.inline-edit input { padding: 8px 10px; }

/* toolbar */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px; }
.search { flex: 1; min-width: 220px; position: relative; }
.search .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input[type=search] { padding-right: 40px; }
.toolbar select { width: auto; min-width: 150px; }
.seg { display: inline-flex; background: rgba(0, 0, 0, .2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 7px 14px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.seg a.on { background: var(--surface-2); color: var(--gold); }

/* pagination */
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 10px 0 20px; }
.pg { min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px; display: inline-grid; place-items: center; border: 1px solid var(--border-2); font-size: 14px; }
a.pg:hover { border-color: var(--gold); color: var(--gold); }
.pg.current { background: var(--gold); color: #03121e; border-color: var(--gold); font-weight: 700; }
.pg.disabled { opacity: .4; }

/* entity cards (sections) */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.entity-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; }
.entity-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(251, 176, 59, .35); }
.ec-media { position: relative; height: 170px; }
.ec-media > img:first-child { width: 100%; height: 100%; object-fit: cover; }
.ec-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(1, 16, 28, .85), transparent 60%); }
.ec-order { position: absolute; top: 12px; left: 12px; z-index: 1; background: rgba(1, 16, 28, .75); padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.ec-status { position: absolute; top: 12px; right: 12px; z-index: 1; }
.ec-logo { position: absolute; bottom: 12px; right: 14px; z-index: 1; max-height: 54px; max-width: 70%; object-fit: contain; }
.ec-body { padding: 16px 18px 8px; flex: 1; }
.ec-body h3 { font-size: 22px; }
.ec-body p { margin: 2px 0; }
.ec-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.ec-actions { display: flex; align-items: center; gap: 8px; padding: 12px 18px 18px; flex-wrap: wrap; }
.ec-actions form { margin: 0 auto 0 0; }

/* client logos */
.logos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.logo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: .3s var(--ease); }
.logo-card:hover { transform: translateY(-3px); border-color: rgba(251, 176, 59, .35); }
.logo-card.off { opacity: .55; }
.logo-box { background: #fff; aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 18px; }
.logo-box img { max-height: 100%; object-fit: contain; }
.logo-info { padding: 12px 14px 4px; }
.logo-info b { display: block; }
.logo-actions { display: flex; gap: 8px; padding: 8px 14px 14px; }
.logo-actions form { margin: 0; }

/* inbox */
.inbox { padding: 6px; }
.inbox-row { display: grid; grid-template-columns: 32px minmax(140px, 220px) 1fr auto; align-items: center; gap: 14px; padding: 13px 14px; border-radius: 10px; border-bottom: 1px solid var(--border); transition: background .2s; }
.inbox-row:last-child { border-bottom: 0; }
.inbox-row:hover { background: rgba(255, 255, 255, .04); }
.inbox-row .who b { display: block; }
.inbox-row .who small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.unread { background: rgba(251, 176, 59, .05); }
.inbox-row.unread .who b { color: var(--gold); }
.inbox-row.unread .avatar { background: var(--gold); color: #03121e; }
.inbox-row .when { white-space: nowrap; }
.message-body { background: rgba(0, 0, 0, .18); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; font-size: 16px; line-height: 1.8; min-height: 140px; }
.message-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.message-actions form { margin: 0; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }
.details.compact { margin-top: 18px; font-size: 13px; }

/* ---------- Forms ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.form-side .sticky { position: sticky; top: 96px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.fields-2.tight { gap: 0 12px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: 14px; }
.req { color: var(--gold); }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px;
  background: rgba(0, 0, 0, .22); border: 1px solid var(--border-2);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { resize: vertical; line-height: 1.7; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 18px 55%, 13px 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 34px; }
select option { background: #062740; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(251, 176, 59, .14); background: rgba(0, 0, 0, .3); }
input::placeholder, textarea::placeholder { color: #5f7a8e; }
.hint { color: var(--muted); font-size: 12.5px; }
.error { color: var(--red); font-size: 13px; }
.has-error input, .has-error textarea, .has-error select, .has-error .drop { border-color: var(--red) !important; }
.char-count { justify-self: end; font-size: 12px; color: var(--muted); margin-top: -2px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: #c9d6e0; }
.check input { width: 17px; height: 17px; accent-color: var(--gold); }
.check.danger { color: var(--red); }

.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px; margin-bottom: 14px; border-radius: 12px; background: rgba(0, 0, 0, .15); border: 1px solid var(--border); cursor: pointer; }
.toggle input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: #34495a; flex: 0 0 auto; transition: background .25s; margin-top: 2px; }
.toggle .thumb { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .3s var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track .thumb { transform: translateX(-20px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(251, 176, 59, .3); }
.toggle-text b { display: block; font-weight: 600; }
.toggle-text small { color: var(--muted); font-size: 12.5px; }

/* uploads */
.drop {
  position: relative; display: grid; place-items: center; min-height: 170px;
  border: 2px dashed var(--border-2); border-radius: 12px; overflow: hidden;
  background: rgba(0, 0, 0, .18); cursor: pointer; text-align: center;
  transition: border-color .25s, background .25s;
}
.drop:hover, .drop.drag { border-color: var(--gold); background: rgba(251, 176, 59, .06); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-empty { display: grid; justify-items: center; gap: 4px; padding: 20px; color: var(--muted); pointer-events: none; }
.drop-empty .ic { color: var(--gold); margin-bottom: 6px; }
.drop-empty b { color: var(--text); font-weight: 600; }
.drop-preview { width: 100%; max-height: 240px; object-fit: cover; }
.drop.contain .drop-preview { object-fit: contain; padding: 14px; background: repeating-conic-gradient(#0b2f4b 0% 25%, #082740 0% 50%) 50% / 18px 18px; }
.drop-change { position: absolute; bottom: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(1, 16, 28, .85); font-size: 12px; pointer-events: none; }
.drop.multi { min-height: 130px; }
.multi-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-top: 10px; }
.multi-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border-2); }

.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 8px 0 18px; }
.g-item { position: relative; background: rgba(0, 0, 0, .2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: grid; grid-template-columns: 1fr 64px; }
.g-item img { grid-column: 1 / -1; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity .25s, filter .25s; }
.g-item input[type=text], .g-item input[type=number] { border-radius: 0; border: 0; border-top: 1px solid var(--border); padding: 8px 10px; font-size: 13px; }
.g-item input[type=number] { border-right: 1px solid var(--border); }
.g-remove { position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(1, 16, 28, .8); color: #fff; cursor: pointer; transition: .25s; }
.g-remove input { position: absolute; opacity: 0; }
.g-remove:hover { background: var(--red); }
.g-item:has(.g-remove input:checked) img { opacity: .3; filter: grayscale(1); }
.g-item:has(.g-remove input:checked) .g-remove { background: var(--red); }
.g-item:has(.g-remove input:checked)::after { content: "هتتحذف"; position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); background: var(--red); color: #fff; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-2); font-size: 13px; transition: .2s; }
.chip input:checked + span { background: rgba(251, 176, 59, .16); border-color: var(--gold); color: var(--gold); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(251, 176, 59, .3); }

.blocks-editor { display: grid; gap: 14px; }
.block-row { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px 2px; margin: 0; }
.block-row legend { padding: 0 8px; color: var(--gold); font-family: var(--f-head); }

/* ---------- Alerts / toasts ---------- */
.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; border: 1px solid; }
.alert ul { margin: 6px 0 0; padding-right: 20px; }
.alert-error { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); color: #fecaca; }
.alert-success { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .35); color: #bbf7d0; }
.toast {
  position: fixed; top: 22px; left: 50%; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 12px 12px; border-radius: 12px;
  background: #0b3354; border: 1px solid var(--border-2); box-shadow: var(--shadow);
  transform: translate(-50%, 0); animation: toastIn .5s var(--ease);
  max-width: calc(100% - 40px);
}
.toast-success .ic:first-child { color: var(--green); }
.toast-error .ic:first-child { color: var(--red); }
.toast-x { background: none; border: 0; color: var(--muted); padding: 4px; margin-right: 6px; border-radius: 6px; }
.toast-x:hover { color: #fff; }
.toast.hide { opacity: 0; transform: translate(-50%, -20px); transition: .4s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* confirm dialog */
.dialog { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(0, 8, 14, .7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .25s; }
.dialog-box { width: min(420px, 100%); background: #072a45; border: 1px solid var(--border-2); border-radius: 18px; padding: 28px; text-align: center; box-shadow: var(--shadow); animation: pop .35s var(--ease); }
.dialog-icon { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: rgba(248, 113, 113, .14); color: var(--red); }
.dialog-box h3 { font-size: 22px; margin-bottom: 8px; }
.dialog-box p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }

/* empty states */
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state .ic { color: var(--gold); opacity: .8; }
.empty-state h3 { color: var(--text); font-size: 22px; }

/* ---------- Login ---------- */
.login-page { display: grid; min-height: 100vh; }
.login-bg { position: fixed; inset: 0; background: url("../img/bg-swirl.svg") center / cover no-repeat; opacity: .9; pointer-events: none; }
.login-shell { position: relative; display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art { display: grid; place-items: center; align-content: center; gap: 26px; padding: 40px; background: radial-gradient(600px 500px at 50% 45%, rgba(251, 176, 59, .09), transparent 70%); }
.login-logo { width: 190px; }
.login-bulb { width: min(340px, 60%); animation: floaty 6s ease-in-out infinite; }
.login-tagline { width: min(360px, 70%); opacity: .9; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.login-card { align-self: center; justify-self: center; width: min(440px, calc(100% - 32px)); padding: 38px 34px; border-radius: 22px; background: rgba(6, 39, 64, .78); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--border-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.login-head { text-align: center; margin-bottom: 24px; }
.login-head .lock { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: rgba(251, 176, 59, .14); color: var(--gold); }
.login-head h1 { font-size: 28px; margin-bottom: 6px; }
.login-head p { color: var(--muted); }
.input-ic { position: relative; }
.input-ic > .ic { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-ic input { padding-right: 42px; padding-left: 44px; height: 48px; }
.pw-toggle { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 8px; }
.pw-toggle:hover { color: var(--gold); }
.login-form .check { margin: 4px 0 10px; }
.login-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--muted); font-size: 14px; }
.login-back:hover { color: var(--gold); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-layout { grid-template-columns: 1fr; }
  .form-side .sticky { position: static; }
}
@media (max-width: 1000px) {
  .sidebar { transform: translateX(100%); box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: -20px 0 60px rgba(0, 0, 0, .5); }
  .sb-overlay { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); opacity: 0; visibility: hidden; transition: .3s; }
  .sidebar.open + .sb-overlay { opacity: 1; visibility: visible; }
  .main { margin-right: 0; }
  .icon-btn.menu-btn { display: inline-grid; }
  .grid-2, .grid-2.wide-first { grid-template-columns: 1fr; }
  .grid-2 > .card { margin-bottom: 0; }
  .hide-md { display: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .tb-title h1 { font-size: 19px; }
  .tb-title p { display: none; }
  .content { padding: 18px 14px 30px; }
  .card { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-ic { width: 42px; height: 42px; }
  .stat-card b { font-size: 26px; }
  .fields-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .inbox-row { grid-template-columns: 32px 1fr auto; }
  .inbox-row .grow { grid-column: 2 / -1; }
  .inline-edit { grid-template-columns: 1fr 1fr; }
  .toolbar select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Project page builder ---------- */
.mt-8 { margin-top: 8px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
code { background: rgba(255, 255, 255, .08); padding: 1px 6px; border-radius: 5px; font-size: 12px; direction: ltr; unicode-bidi: embed; }
.builder .card-head { margin-bottom: 8px; }
.blocks-list { display: grid; gap: 14px; margin: 16px 0; }
.blk {
  border: 1px solid var(--border-2); border-radius: 14px; overflow: hidden;
  background: rgba(0, 0, 0, .16);
  transition: border-color .25s, box-shadow .25s, opacity .25s, transform .25s;
}
.blk:hover { border-color: rgba(251, 176, 59, .35); }
.blk.has-error { border-color: var(--red); }
.blk.dragging { opacity: .45; border-style: dashed; border-color: var(--gold); }
.blk.removing { opacity: 0; transform: scale(.97); }
.blk.flash { animation: blkFlash 1s var(--ease); }
@keyframes blkFlash { 0% { box-shadow: 0 0 0 0 rgba(251, 176, 59, .7); } 100% { box-shadow: 0 0 0 14px rgba(251, 176, 59, 0); } }
.blk-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: linear-gradient(90deg, rgba(251, 176, 59, .04), rgba(251, 176, 59, .1));
  border-bottom: 1px solid var(--border);
}
.blk.collapsed .blk-body { display: none; }
.blk.collapsed .blk-head { border-bottom: 0; }
.blk-handle { cursor: grab; color: var(--muted); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.blk-handle:hover { color: var(--gold); background: rgba(251, 176, 59, .1); }
.blk-handle:active { cursor: grabbing; }
.blk-type { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); font-weight: 700; white-space: nowrap; }
.blk-preview { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-actions { display: inline-flex; gap: 6px; }
.blk-body { padding: 16px 16px 4px; }
.blk-hint { margin-top: -4px; margin-bottom: 12px; }
.blocks-empty {
  display: grid; justify-items: center; gap: 6px; padding: 30px; margin: 14px 0;
  border: 2px dashed var(--border-2); border-radius: 14px; color: var(--muted); text-align: center;
}
.blocks-empty .ic { color: var(--gold); }
.blocks-empty b { color: var(--text); font-size: 16px; }
.add-blocks {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 14px; border-radius: 14px; background: rgba(251, 176, 59, .05); border: 1px solid rgba(251, 176, 59, .2);
}
.add-blocks .label { margin-left: 4px; }
.add-block {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border-2); font-weight: 600; font-size: 14px;
  transition: .2s var(--ease);
}
.add-block .ic { color: var(--gold); }
.add-block:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }
.seg-radio { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-radio input { position: absolute; opacity: 0; }
.seg-radio span { display: inline-block; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--border-2); font-size: 13px; cursor: pointer; transition: .2s; }
.seg-radio input:checked + span { background: rgba(251, 176, 59, .16); border-color: var(--gold); color: var(--gold); }
.seg-radio input:focus-visible + span { box-shadow: 0 0 0 3px rgba(251, 176, 59, .3); }
.drop.sm { min-height: 96px; }
.gallery-edit.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 4px 0 12px; }
.g-item input.full { grid-column: 1 / -1; }
.draft-note { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Pages editor ---------- */
.span-2 { grid-column: 1 / -1; }
.item-grid { display: grid; gap: 0 18px; }
.item-grid.has-image { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.drop.contain-cover .drop-preview { max-height: 200px; }
.add-block:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.toc { display: grid; gap: 4px; margin: 6px 0 12px; }
.toc a { padding: 7px 10px; border-radius: 8px; color: #c9d6e0; font-size: 13.5px; border: 1px solid transparent; }
.toc a:hover { border-color: var(--border-2); color: var(--gold); }
.page-card { flex-direction: row; flex-wrap: wrap; align-items: center; }
.page-card .ec-body { flex: 1; min-width: 200px; }
.page-card-icon { width: 76px; height: 76px; margin: 18px 18px 0 0; border-radius: 20px; display: grid; place-items: center; background: rgba(251, 176, 59, .14); color: var(--gold); }
.page-card .ec-actions { width: 100%; }
.note-card { display: flex; gap: 14px; align-items: flex-start; margin-top: 22px; }
.note-card > .ic { color: var(--gold); margin-top: 3px; }
@media (max-width: 640px) { .item-grid.has-image { grid-template-columns: 1fr; } }
.group-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: rgba(96, 165, 250, .08); border: 1px solid rgba(96, 165, 250, .25); color: #cfe3ff; font-size: 14px; }
.group-note .ic { color: var(--blue); }
.group-note span { flex: 1; min-width: 200px; }
.bulk-upload .card-head { flex-wrap: wrap; }
.bulk-upload .multi-preview img { object-fit: contain; background: #fff; padding: 8px; }
