:root {
  --bg: #f7f2ea; --panel: #fff; --side: #fbf8f3; --line: #ebe2d3; --ink: #1d1e2c; --muted: #77778a;
  --navy: #0f1446; --navy-2: #2b3087; --gold: #c9a253; --gold-soft: #f5ead3; --red: #ee3b3b;
  --green: #1f8a4c; --green-soft: #e3f4ea; --amber: #a26b00; --amber-soft: #fbefd6; --red-soft: #fdeaea;
  --radius: 14px; --shadow: 0 10px 30px -18px rgba(15, 20, 70, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Jost', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[dir="rtl"], .ar { font-family: 'Tajawal', system-ui, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 80% at 80% 0%, #2b3087 0%, #141850 50%, #0b0d2e 100%); }
.login__card { width: min(400px, 100%); background: #fff; border-radius: 22px; padding: 36px 32px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); }
.login__card img { width: 150px; margin: 0 auto 10px; }
.login__card h1 { text-align: center; font-size: 18px; font-weight: 600; margin: 0 0 24px; color: var(--muted); }
.login__card .btn { width: 100%; margin-top: 8px; height: 46px; }

/* Shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); border-inline-end: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side__brand img { height: 38px; width: auto; }
.side__brand span { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.side h6 { margin: 18px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.side a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #34354a; font-weight: 500; }
.side a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.side a:hover { background: #f1e9db; }
.side a.active { background: #efe4d0; color: var(--navy); }
.side a .count { margin-inline-start: auto; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.side__foot { margin-top: auto; padding: 14px 8px 0; font-size: 12px; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px;
  background: rgba(247, 242, 234, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .top__menu { display: none; }
.top__spacer { flex: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--gold-soft); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.page { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }
.crumb { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { margin: 0; font-size: 24px; font-weight: 600; color: var(--navy); }
.head p { margin: 4px 0 0; color: var(--muted); }
.head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #d8cbb3; background: #fffcf6; }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn--danger { color: #b42323; }
.btn--danger:hover { background: var(--red-soft); border-color: #f2c4c4; }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; padding: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: #3a3b50; }
.field small { color: var(--muted); font-size: 12.5px; }
.input, .field input[type="text"], .field input[type="number"], .field input[type="email"], .field input[type="password"], .field input[type="url"], .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 83, .18); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .tag { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-inline-end: 6px; }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; user-select: none; }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #d9d2c4; transition: background .2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 220px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: #efe7d9; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { height: 34px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; font-weight: 500; color: #4b4c60; }
.tabs button.active { background: var(--navy); color: #fff; }

/* Cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card__head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card__body { padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { padding: 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 30px; font-weight: 600; color: var(--navy); margin-top: 4px; }
.stat--hot { background: linear-gradient(140deg, var(--navy), var(--navy-2)); border-color: transparent; }
.stat--hot span { color: rgba(255, 255, 255, .7); }
.stat--hot strong { color: var(--gold-soft); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid #f1eadf; vertical-align: middle; }
th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #fcfaf6; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffcf6; }
.thumb { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: #f1eadf; border: 1px solid var(--line); }
.ar { direction: rtl; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--gray { background: #efebe4; color: #6e6b62; }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: #b42323; }
.badge--navy { background: #e7e8f6; color: var(--navy-2); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Banner list */
.blist { display: grid; gap: 12px; }
.bitem { display: grid; grid-template-columns: 200px 1fr auto; gap: 18px; align-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.bitem.off { opacity: .6; }
.bprev { position: relative; height: 92px; border-radius: 10px; overflow: hidden; background: radial-gradient(120% 120% at 80% 30%, #2b3087, #10133d); color: #fff; padding: 12px; display: flex; flex-direction: column; justify-content: center; }
.bprev img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.bprev b { position: relative; font-size: 13px; line-height: 1.25; max-width: 80%; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.bprev i { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--gold); display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 12px; color: #f3dc9a; background: rgba(16, 19, 61, .8); }
.bmeta { display: grid; gap: 4px; min-width: 0; }
.bmeta .line { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.bmeta .line span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bside { display: grid; gap: 8px; justify-items: end; }

/* Inquiries */
.inq { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.inq.new { border-inline-start: 4px solid var(--red); }
.inq__top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inq__who strong { font-size: 16px; }
.inq__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.inq__meta a { color: var(--navy-2); }
.inq__msg { margin: 12px 0; padding: 12px 14px; background: #fcfaf6; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.inq__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inq__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mini-inq { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f1eadf; text-decoration: none; }
.mini-inq:last-child { border-bottom: 0; }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer__bg { position: absolute; inset: 0; background: rgba(15, 20, 70, .35); opacity: 0; transition: opacity .25s; }
.drawer.open .drawer__bg { opacity: 1; }
.drawer__panel { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(720px, 100%); background: var(--bg); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: -20px 0 50px -20px rgba(0, 0, 0, .3); }
.drawer.open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer__head h2 { margin: 0; font-size: 18px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fff; }
.fieldset { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 4px; margin-bottom: 14px; }
.fieldset h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--navy); }
.imgfield { display: flex; gap: 12px; align-items: flex-start; }
.imgfield__prev { width: 96px; height: 96px; flex: none; border-radius: 10px; border: 1px dashed #d8cbb3; background: #fcfaf6 center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.imgfield__ctl { flex: 1; display: grid; gap: 8px; }
.imgfield__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery figure { position: relative; margin: 0; width: 76px; height: 76px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.gallery figure img { width: 100%; height: 100%; object-fit: cover; }
.gallery figure button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; line-height: 1; }
.gallery .add { width: 76px; height: 76px; border-radius: 9px; border: 1px dashed #d8cbb3; background: #fcfaf6; color: var(--muted); font-size: 24px; }

/* Toast */
.toasts { position: fixed; z-index: 300; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: var(--shadow); animation: tin .25s ease; font-weight: 500; }
.toast.err { background: #b42323; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 90; inset-block: 0; inset-inline-start: 0; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .nav-open .side { transform: none; box-shadow: 20px 0 50px -20px rgba(0, 0, 0, .3); }
  .top .top__menu { display: inline-flex; }
  .page { padding: 20px 16px 60px; }
  .top { padding: 0 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .bitem { grid-template-columns: 1fr; }
  .bside { justify-items: start; grid-auto-flow: column; justify-content: space-between; }
  .pair { grid-template-columns: 1fr; }
}
