/* MARS dashboard */
@font-face { font-family: "Plex Ar"; font-weight: 400; src: url(fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Plex Ar"; font-weight: 500; src: url(fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Plex Ar"; font-weight: 600; src: url(fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-weight: 400; src: url(fonts/instrument-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #0b0b0c; --bg-2: #111113; --card: #161618; --card-2: #1c1c1f; --line: #26262a; --line-2: #34343a;
  --text: #ece7dd; --muted: #9a958b; --dim: #6b675f;
  --gold: #c9a15c; --gold-hi: #ecd29b; --gold-bg: rgba(201, 161, 92, .12);
  --ok: #5fb27a; --warn: #e0a447; --danger: #d0605e;
  --radius: 12px; --side: 260px;
  --font: "Plex Ar", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; direction: ltr; unicode-bidi: isolate; }
::selection { background: var(--gold); color: #000; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2); border-inline-end: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.side__brand img { height: 20px; width: auto; }
.side__brand span { font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); padding: 2px 8px; border-radius: 99px; }
.side__label { font-size: 11.5px; color: var(--dim); padding: 14px 12px 6px; letter-spacing: .02em; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--muted); transition: background .2s, color .2s; }
.side a:hover { background: var(--card); color: var(--text); }
.side a.is-active { background: var(--gold-bg); color: var(--gold-hi); }
.side a svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.side a .count { margin-inline-start: auto; font-size: 11.5px; background: var(--gold); color: #000; border-radius: 99px; padding: 0 7px; font-weight: 600; }
.side__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(11, 11, 12, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar__crumbs { color: var(--muted); font-size: 13px; }
.topbar__actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; }
.content { padding: 28px; display: grid; gap: 22px; align-content: start; }
.content--wide { padding: 0; }

/* ---------- elements ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .2s, border-color .2s, color .2s; }
.btn:hover { border-color: var(--gold); }
.btn svg { width: 16px; height: 16px; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #0b0b0c; font-weight: 600; }
.btn--gold:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); background: transparent; }
.btn--danger:hover { border-color: var(--danger); background: rgba(208, 96, 94, .1); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn--icon { width: 34px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card__head h2 { font-size: 15px; font-weight: 600; }
.card__head p { color: var(--muted); font-size: 13px; }
.card__head .btn { margin-inline-start: auto; }
.card__body { padding: 20px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.stat { padding: 18px 20px; display: grid; gap: 4px; }
.stat__num { font: 400 40px/1 "Instrument Serif", serif; color: var(--text); }
.stat__label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat__label svg { width: 15px; height: 15px; color: var(--gold); }

.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid; display: flex; gap: 10px; align-items: center; }
.alert--ok { border-color: rgba(95, 178, 122, .4); background: rgba(95, 178, 122, .08); color: #9ad6ad; }
.alert--warn { border-color: rgba(224, 164, 71, .4); background: rgba(224, 164, 71, .08); color: #f0c785; }
.alert--err { border-color: rgba(208, 96, 94, .4); background: rgba(208, 96, 94, .08); color: #eb9a98; }
.alert ul { margin: 0; padding-inline-start: 18px; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; background: var(--card-2); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge--gold { background: var(--gold-bg); border-color: rgba(201, 161, 92, .4); color: var(--gold-hi); }
.badge--ok { background: rgba(95, 178, 122, .1); border-color: rgba(95, 178, 122, .35); color: #9ad6ad; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

/* ---------- table / list ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--dim); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255, 255, 255, .015); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.thumb { width: 64px; height: 40px; border-radius: 6px; object-fit: cover; background: #000; border: 1px solid var(--line); }
.thumb--logo { object-fit: contain; padding: 4px; background: #222; }
.handle { cursor: grab; color: var(--dim); display: inline-grid; place-items: center; width: 24px; }
.handle svg { width: 16px; height: 16px; }
.is-dragging { opacity: .4; }
.drag-over td, .drag-over { box-shadow: inset 0 2px 0 var(--gold); }
.is-off td:not(:last-child):not(:first-child) { opacity: .45; }
.is-off.section-row .section-row__main { opacity: .45; }

.section-list { display: grid; gap: 8px; }
.section-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.section-row__main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.section-row__num { font: 400 22px/1 "Instrument Serif", serif; color: var(--gold); width: 28px; }
.section-row strong { font-weight: 600; }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field > label, .field__label { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.field__help { font-size: 12px; color: var(--dim); }
.field__error { font-size: 12.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.textarea--code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; min-height: 260px; direction: ltr; text-align: left; tab-size: 2; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 161, 92, .15); }
.input[dir="ltr"], .textarea[dir="ltr"] { text-align: left; }
.i18n { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.i18n__item { position: relative; }
.i18n__tag { position: absolute; top: 9px; inset-inline-end: 10px; font-size: 10.5px; font-weight: 600; color: var(--dim); pointer-events: none; letter-spacing: .05em; }
.i18n__item .input { padding-inline-end: 34px; }
.i18n__item .textarea { padding-top: 22px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .switch__track { background: var(--gold); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(201, 161, 92, .3); }

.color { display: flex; gap: 8px; align-items: center; }
.color__swatch { position: relative; width: 40px; height: 40px; flex: none; border-radius: 9px; border: 1px solid var(--line-2); overflow: hidden; background-image: linear-gradient(45deg, #333 25%, transparent 25%), linear-gradient(-45deg, #333 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #333 75%), linear-gradient(-45deg, transparent 75%, #333 75%); background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0; }
.color__swatch i { position: absolute; inset: 0; }
.color__swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.color .input { direction: ltr; text-align: left; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

.fluid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fluid label { display: grid; gap: 3px; font-size: 11px; color: var(--dim); }
.fluid .input { direction: ltr; text-align: left; height: 36px; }
.fluid__out { grid-column: 1 / -1; font-size: 11.5px; color: var(--dim); }

.range { display: flex; gap: 10px; align-items: center; }
.range input[type=range] { flex: 1; accent-color: var(--gold); }
.range .input { width: 86px; direction: ltr; text-align: left; height: 36px; }

.media { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.media__preview { width: 120px; aspect-ratio: 16/10; border-radius: 8px; background: #000 center/cover; border: 1px solid var(--line-2); overflow: hidden; display: grid; place-items: center; color: var(--dim); font-size: 11px; }
.media__preview img, .media__preview video { width: 100%; height: 100%; object-fit: cover; }
.media__preview.is-logo img { object-fit: contain; padding: 8px; background: #222; }
.media__ctrl { display: grid; gap: 8px; }
.media__ctrl .input { direction: ltr; text-align: left; font-size: 13px; }
.media__row { display: flex; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .is-active { color: var(--gold-hi); border-bottom-color: var(--gold); }
[data-tab-panel][hidden] { display: none !important; }

.sticky-actions { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; background: rgba(22, 22, 24, .92); backdrop-filter: blur(8px); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- themes ---------- */
.theme-card { overflow: hidden; display: flex; flex-direction: column; }
.theme-card__preview { height: 132px; padding: 18px; display: grid; align-content: space-between; border-bottom: 1px solid var(--line); }
.theme-card__preview b { font: 400 30px/1 "Instrument Serif", serif; }
.theme-card__preview em { font-style: italic; }
.theme-card__dots { display: flex; gap: 6px; }
.theme-card__dots i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .15); }
.theme-card__body { padding: 14px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.theme-card__body h3 { font-size: 14.5px; font-weight: 600; margin-inline-end: auto; }

/* builder */
.builder { display: grid; grid-template-columns: 400px minmax(0, 1fr); height: calc(100vh - 67px); }
.builder__panel { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); }
.builder__top { padding: 14px 16px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.builder__groups { display: flex; flex-wrap: wrap; gap: 6px; }
.builder__groups button { height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.builder__groups button.is-active { background: var(--gold); border-color: var(--gold); color: #000; font-weight: 600; }
.builder__scroll { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.builder__foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.builder__foot .status { font-size: 12.5px; color: var(--muted); margin-inline-end: auto; }
.token { display: grid; gap: 7px; padding-bottom: 16px; border-bottom: 1px dashed var(--line); }
.token:last-child { border-bottom: 0; }
.token__head { display: flex; align-items: center; gap: 8px; }
.token__head label { font-size: 13px; font-weight: 500; }
.token__head code { color: var(--dim); font-size: 11px; }
.token__reset { margin-inline-start: auto; border: 0; background: none; color: var(--dim); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 6px; visibility: hidden; }
.token.is-changed .token__reset { visibility: visible; }
.token__reset:hover { color: var(--gold-hi); background: var(--gold-bg); }
.token.is-changed .token__head label::after { content: " •"; color: var(--gold); }
.builder__stage { display: flex; flex-direction: column; min-width: 0; background: #050505; }
.builder__bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.builder__bar .seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.builder__bar .seg button { height: 32px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.builder__bar .seg button.is-active { background: var(--card-2); color: var(--gold-hi); }
.builder__frame { flex: 1; display: grid; place-items: center; padding: 16px; overflow: auto; }
.builder__frame iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 10px; background: #000; transition: width .35s ease; }
.builder__frame[data-device="tablet"] iframe { width: 820px; max-width: 100%; }
.builder__frame[data-device="mobile"] iframe { width: 390px; max-width: 100%; }
.preview-hint { font-size: 12px; color: var(--dim); margin-inline-start: auto; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 80% 0%, rgba(201, 161, 92, .12), transparent 60%), var(--bg); }
.auth__card { width: min(400px, 100%); padding: 32px; display: grid; gap: 20px; }
.auth__card img { height: 26px; width: auto; }
.auth__card h1 { font-size: 20px; font-weight: 600; }

/* lead */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.message-box { white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--line-2); font-size: 13px; }
.pagination .is-current { background: var(--gold); color: #000; border-color: var(--gold); }

@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side); z-index: 50; transform: translateX(100%); transition: transform .3s; }
  body.side-open .side { transform: none; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 18px; }
  .topbar { padding: 12px 16px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .i18n { grid-template-columns: 1fr; }
  .builder { grid-template-columns: 1fr; height: auto; }
  .builder__panel { max-height: none; }
  .builder__stage { height: 80vh; }
  .table .hide-sm { display: none; }
  .media { grid-template-columns: 1fr; }
}
