/* =====================================================================
   MT Platform
   حبر كحلي + فيروزي دجلة + ذهبي التمر، وألوان حالات التوصيل هي هوية الواجهة
   ===================================================================== */
:root {
  --ink: #17203A;
  --ink-2: #4A5470;
  --ink-3: #8089A1;
  --paper: #FAFBFC;
  --surface: #FFFFFF;
  --rule: #E3E7EE;
  --rule-2: #EEF1F5;
  --teal: #0B6E6E;
  --teal-ink: #FFFFFF;
  --teal-soft: #E3F1F0;
  --gold: #B8862B;
  --gold-soft: #F7EEDB;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --ok: #157A4A;
  --ok-soft: #E4F4EA;
  --warn: #9A5B00;
  --warn-soft: #FDF1DC;

  /* حالات التوصيل (نفس ألوان كروب موج) */
  --st-prep: #E3B02B;
  --st-ready: #E07B24;
  --st-transit: #2F6FDB;
  --st-postponed: #A7AFBF;
  --st-delivered: #1E9E5A;
  --st-driver_return: #8A4FD6;
  --st-returned: #D64545;
  --st-cancelled: #3B4254;

  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 7px;
  --sidebar: 248px;
  --font: "Readex Pro", system-ui, "Segoe UI", Tahoma, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8ECF5; --ink-2: #AEB6CB; --ink-3: #7C86A0;
    --paper: #0F1424; --surface: #161C30; --rule: #262E47; --rule-2: #1D2439;
    --teal: #3FB3AC; --teal-ink: #08201F; --teal-soft: #13302F;
    --gold: #D9AE5A; --gold-soft: #2D2717;
    --danger: #F28B82; --danger-soft: #3A1C1C;
    --ok: #6FD39C; --ok-soft: #14301F; --warn: #F2C063; --warn-soft: #33290F;
    --st-cancelled: #6B7390;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.65 var(--font);
  font-feature-settings: "tnum" 1;
}
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }
h1 { font-size: 22px; letter-spacing: -.2px; }
h2 { font-size: 17px; }
p { margin: 0; }
a { color: var(--teal); text-underline-offset: 3px; }
small, .muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ic { flex: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

/* ---------- الشعار ---------- */
.logo { text-decoration: none; display: inline-flex; }
.logo-mark {
  font-weight: 700; font-size: 18px; letter-spacing: 1px; direction: ltr;
  color: var(--teal-ink); background: var(--teal);
  padding: 4px 11px 5px; border-radius: 8px 8px 8px 2px;
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 15px/1 var(--font); text-decoration: none; cursor: pointer;
  padding: 12px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--teal); color: var(--teal-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--teal) 88%, #000); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }

/* ---------- الحقول ---------- */
.fields { display: grid; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
legend { float: inline-start; width: 100%; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0; margin: 0 0 -4px; }
legend + * { clear: both; }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-weight: 500; font-size: 14px; }
.field > span i { font-style: normal; color: var(--ink-3); font-weight: 400; font-size: 12px; margin-inline-start: 4px; }
.field small { font-size: 12.5px; line-height: 1.5; }
input {
  font: 400 15px/1.4 var(--font); color: var(--ink); width: 100%;
  padding: 12px 13px; border-radius: var(--r-md);
  border: 1px solid var(--rule); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--ink-3); }
input:hover { border-color: var(--ink-3); }
input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
input[dir="ltr"] { text-align: left; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.with-unit { position: relative; display: block; }
.with-unit em { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--ink-3); font-size: 13px; }
.with-unit input { padding-inline-start: 46px; }

.choices { display: grid; gap: 8px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 13px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface);
}
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.choice input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--teal); flex: none; }
.choice span { display: grid; gap: 2px; }
.choice small { font-size: 13px; }

/* ---------- التنبيهات ---------- */
.notice { display: flex; flex-direction: column; gap: 6px; padding: 13px 15px; border-radius: var(--r-md); font-size: 14px; }
.notice ul { margin: 0; padding-inline-start: 18px; }
.notice.is-error { background: var(--danger-soft); color: var(--danger); }
.notice.is-ok { background: var(--ok-soft); color: var(--ok); flex-direction: row; align-items: center; gap: 8px; margin-bottom: 18px; }
.notice p { color: var(--ink-2); }
.ip { align-self: flex-start; font: 600 16px/1 ui-monospace, Menlo, monospace; color: var(--ink); background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); border: 1px dashed var(--rule); user-select: all; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  background: var(--rule-2); color: var(--ink-2); text-decoration: none;
}
.pill.is-ok { background: var(--ok-soft); color: var(--ok); }
.pill.is-warn { background: var(--warn-soft); color: var(--warn); }

/* =====================================================================
   صفحات الدخول والتسجيل
   ===================================================================== */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-main { display: flex; flex-direction: column; padding: 32px clamp(20px, 6vw, 72px); }
.auth-form { width: 100%; max-width: 420px; margin: auto 0; padding: 40px 0; }
.auth-form h1 { font-size: 28px; margin-bottom: 8px; }
.auth-form .lead { color: var(--ink-2); margin-bottom: 26px; }
.auth-form .notice { margin-bottom: 22px; }
.auth-form .fields { gap: 26px; }
.auth-form fieldset + fieldset { border-top: 1px solid var(--rule); padding-top: 22px; }
.switch { margin-top: 22px; color: var(--ink-2); font-size: 14px; }
.auth-legal { color: var(--ink-3); font-size: 12.5px; }

.auth-side {
  background: var(--ink); color: #E8ECF5; padding: clamp(32px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: center; gap: 40px;
  position: relative; overflow: hidden;
}
@media (prefers-color-scheme: dark) { .auth-side { background: #0A0E1B; } }
.side-title { font-size: clamp(24px, 2.6vw, 34px); font-weight: 600; line-height: 1.35; max-width: 16ch; }
.side-sub { color: #AEB6CB; margin-top: 12px; max-width: 38ch; }

/* الوصل */
.waybill {
  background: #FFFFFF; color: #17203A; border-radius: 6px; width: min(100%, 380px);
  padding: 22px 22px 18px; position: relative;
  transform: rotate(-2.2deg); transform-origin: 70% 30%;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.55);
}
.waybill::before, .waybill::after {
  content: ""; position: absolute; left: 0; right: 0; height: 10px;
  background: radial-gradient(circle at 6px 0, transparent 5px, #FFFFFF 5.5px) repeat-x;
  background-size: 12px 10px;
}
.waybill::before { top: -9px; transform: rotate(180deg); }
.waybill::after { bottom: -9px; }
.wb-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 12px; border-bottom: 1.5px dashed #CBD1DC; }
.wb-store { font-weight: 700; font-size: 17px; }
.wb-no { font-size: 12.5px; color: #6B748C; direction: rtl; }
.wb-rows { display: grid; gap: 9px; padding: 14px 0; border-bottom: 1.5px dashed #CBD1DC; font-size: 14px; }
.wb-rows div { display: flex; justify-content: space-between; gap: 12px; }
.wb-rows span { color: #6B748C; }
.wb-rows b { font-weight: 500; text-align: left; }
.wb-trail { list-style: none; margin: 0; padding: 14px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11.5px; color: #6B748C; }
.wb-trail li { padding-top: 9px; border-top: 4px solid; border-radius: 2px; text-align: center; background: none; color: #6B748C; }
.wb-trail .st-prep { border-color: var(--st-prep); }
.wb-trail .st-ready { border-color: var(--st-ready); }
.wb-trail .st-transit { border-color: var(--st-transit); }
.wb-trail .st-delivered { border-color: var(--st-delivered); color: var(--st-delivered); font-weight: 600; }

/* =====================================================================
   الواجهة الداخلية
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 22px 16px; background: var(--surface); border-inline-end: 1px solid var(--rule);
}
.sidebar .logo { padding-inline: 8px; }
.store { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--rule-2); }
.store-initial { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.store-text { display: grid; line-height: 1.35; min-width: 0; }
.store-text b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-text small { font-size: 12px; }

.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-size: 14.5px; position: relative;
}
a.nav-item:hover { background: var(--paper); color: var(--ink); }
.nav-item.is-active { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.nav-item.is-active::before { content: ""; position: absolute; inset-inline-start: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--teal); }
.nav-item.is-soon { color: var(--ink-3); cursor: default; }
.nav-item em { margin-inline-start: auto; font-style: normal; font-size: 11px; color: var(--ink-3); }

.signout { margin-top: auto; }
.signout button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px;
  background: none; border: 0; border-radius: var(--r-sm); color: var(--ink-3);
  font: 400 14px var(--font); cursor: pointer;
}
.signout button:hover { color: var(--danger); background: var(--danger-soft); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 30px clamp(18px, 3vw, 40px) 18px;
}
.topbar-title { display: grid; gap: 4px; }
.crumb { font-size: 13px; color: var(--ink-3); text-decoration: none; }
.crumb:hover { color: var(--teal); }
.topbar-meta { color: var(--ink-3); font-size: 14px; }
.content { padding: 0 clamp(18px, 3vw, 40px) 48px; max-width: 1180px; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 20px 22px; }
.content > .panel, .content > section { margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* شريط الحالات */
.ribbon-panel .big { font-size: 30px; font-weight: 600; line-height: 1; }
.ribbon { display: flex; gap: 3px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--rule-2); }
.ribbon .seg { min-width: 6px; }
.ribbon.is-empty {
  height: auto; padding: 14px 16px; border-radius: var(--r-md); background: repeating-linear-gradient(-45deg, var(--rule-2) 0 8px, transparent 8px 16px);
  color: var(--ink-2); font-size: 14px;
}
.legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.legend li b { margin-inline-start: auto; font-weight: 600; color: var(--ink); }
.legend li.is-zero { color: var(--ink-3); }
.legend li.is-zero b { color: var(--ink-3); font-weight: 400; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

.st-prep { background: var(--st-prep); }
.st-ready { background: var(--st-ready); }
.st-transit { background: var(--st-transit); }
.st-postponed { background: var(--st-postponed); }
.st-delivered { background: var(--st-delivered); }
.st-driver_return { background: var(--st-driver_return); }
.st-returned { background: var(--st-returned); }
.st-cancelled { background: var(--st-cancelled); }
.status { display: inline-flex; align-items: center; gap: 7px; background: none; font-size: 13.5px; }

/* معادلة الربح */
.equation { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.term { display: grid; gap: 4px; padding: 4px 0; min-width: 0; }
.term span { font-size: 12.5px; color: var(--ink-3); }
.term b { font-size: 20px; font-weight: 500; }
.op { align-self: flex-end; width: 13px; height: 2px; border-radius: 2px; background: var(--ink-3); margin: 0 4px 21px; }
.op.is-eq { height: 7px; background: none; border-block: 2px solid var(--ink-3); margin-bottom: 19px; }
.term.result { margin-inline-start: auto; padding: 10px 16px; border-radius: var(--r-md); background: var(--teal-soft); grid-template-columns: auto auto; column-gap: 6px; }
.term.result span { grid-column: 1 / -1; color: var(--teal); }
.term.result b { font-size: 26px; font-weight: 700; color: var(--teal); }
.term.result em { font-style: normal; color: var(--teal); align-self: end; padding-bottom: 4px; font-size: 13px; }
.term.result.is-neg { background: var(--danger-soft); }
.term.result.is-neg span, .term.result.is-neg b, .term.result.is-neg em { color: var(--danger); }

.columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 0 8px 10px; border-bottom: 1px solid var(--rule); }
.table td { padding: 11px 8px; border-bottom: 1px solid var(--rule-2); }
.table tr:last-child td { border-bottom: 0; }

.empty { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--r-md); background: var(--paper); border: 1px dashed var(--rule); color: var(--ink-2); font-size: 14px; }
.empty .ic { color: var(--teal); margin-top: 2px; }
.empty b { color: var(--ink); font-weight: 600; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule-2); }
.rows li:first-child { border-top: 0; padding-top: 0; }
.row-body { display: grid; flex: 1; min-width: 0; line-height: 1.4; }
.row-body small { font-size: 12.5px; }
.stock-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.seal {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 19px;
}
.seal.sm { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }

/* شركات التوصيل */
.intro { max-width: 60ch; margin-bottom: 20px; }
.intro h2 { font-size: 19px; margin-bottom: 6px; }
.intro p { color: var(--ink-2); }
.courier-list { display: grid; gap: 10px; max-width: 760px; }
.courier {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  color: var(--ink); text-decoration: none; transition: border-color .15s;
}
a.courier:hover { border-color: var(--teal); }
.courier.is-connected { border-color: color-mix(in srgb, var(--ok) 40%, var(--rule)); }
.courier.is-connected .seal { background: var(--teal); color: var(--teal-ink); }
.courier.is-soon { background: transparent; border-style: dashed; color: var(--ink-3); }
.courier.is-soon .seal { background: var(--rule-2); color: var(--ink-3); }
.courier-body { display: grid; flex: 1; min-width: 0; line-height: 1.4; }
.courier-body b { font-weight: 600; font-size: 16px; }
.courier-body small { font-size: 13px; }
.after { margin-top: 22px; }

/* صفحة الربط */
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; max-width: 940px; }
.split .panel.fields { padding: 26px; }
.split fieldset + fieldset { border-top: 1px solid var(--rule-2); padding-top: 20px; }
.note { background: var(--paper); }
.note .ic { color: var(--teal); }
.note h2 { margin: 10px 0 10px; font-size: 16px; }
.note ul { margin: 0; padding-inline-start: 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 8px; }

/* شريط الموبايل */
.tabbar { display: none; }

/* =====================================================================
   الموبايل والتابلت
   ===================================================================== */
@media (max-width: 1080px) {
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { padding: 36px 20px 48px; gap: 26px; }
  .side-title { font-size: 22px; max-width: none; }
  .waybill { transform: rotate(-1.4deg); width: min(100%, 340px); margin-inline: auto; }
  .auth-form { padding: 28px 0 12px; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--rule);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; color: var(--ink-3); text-decoration: none; }
  .tab.is-active { color: var(--teal); font-weight: 600; }
  .tab.is-soon { opacity: .45; }
  .content { padding-bottom: 96px; }
  .topbar { padding-top: 22px; align-items: flex-start; flex-direction: column; gap: 4px; }
  .panel { padding: 16px; border-radius: 14px; }
  .pair { grid-template-columns: 1fr; }
  .equation { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; }
  .equation .term { grid-column: 1; display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--rule-2); }
  .equation .term b { font-size: 16px; }
  .equation .op { display: none; }
  .equation .term.result { grid-column: 1; margin: 10px 0 0; display: flex; padding: 12px 14px; border: 0; }
  .equation .term.result span { margin-inline-end: auto; }
  .equation .term.result b { font-size: 22px; }
  .courier { flex-wrap: wrap; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* =====================================================================
   المخزون
   ===================================================================== */
.topbar-meta .btn { font-size: 14px; }
.after-sm { margin-top: 12px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 0; }

.empty-stock { display: grid; justify-items: start; gap: 12px; padding: 32px; max-width: 640px; }
.empty-stock .ic { color: var(--teal); }
.empty-stock p { color: var(--ink-2); max-width: 54ch; }

.stock-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px;
  padding: 16px 20px; margin-bottom: 14px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-lg);
}
.stock-summary div { display: grid; gap: 2px; }
.stock-summary span { font-size: 12.5px; color: var(--ink-3); }
.stock-summary b { font-size: 22px; font-weight: 600; }
.stock-summary em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.stock-summary div:nth-child(4) { grid-template-columns: auto auto; column-gap: 4px; align-items: end; }
.stock-summary div:nth-child(4) span { grid-column: 1 / -1; }
.stock-summary .pill { margin-inline-start: auto; }

.search { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; max-width: 420px; }

.stock-table-panel { padding: 8px 18px; }
.stock-table td { vertical-align: middle; }
.stock-table td.strong { font-weight: 600; font-size: 15px; }
.stock-table tr.is-low td:first-child { box-shadow: inset -3px 0 0 var(--st-ready); }
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--teal); text-decoration: underline; }
.cat { display: block; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 9px;
  border: 1px solid var(--rule); border-radius: 999px; font-size: 12.5px; color: var(--ink-2); background: var(--paper);
}
.chip b { font-weight: 600; color: var(--ink); }
.chip.is-low { border-color: color-mix(in srgb, var(--st-ready) 55%, var(--rule)); }

.product-form { margin-bottom: 16px; }
.variants { display: grid; gap: 8px; }
.v-head, .v-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr 0.9fr 0.7fr; gap: 8px; align-items: center; }
.v-head span { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.v-row input { padding: 10px 11px; }
.v-stock { font-size: 13px; color: var(--ink-3); padding-inline: 4px; }
.v-stock b { color: var(--ink); font-weight: 600; }
.product-form #add-variant { justify-self: start; }

.qty-list { display: grid; gap: 10px; }
.qty-item { display: grid; grid-template-columns: minmax(140px, 0.8fr) 2fr 1.6fr; gap: 16px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--rule-2); }
.qty-item:first-child { border-top: 0; padding-top: 0; }
.qty-item.is-low .qty-name b { color: var(--warn); }
.qty-name { display: grid; gap: 6px; justify-items: start; }
.qty-nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; }
.qty-nums div { display: grid; gap: 2px; }
.qty-nums dt { font-size: 11.5px; color: var(--ink-3); }
.qty-nums dd { margin: 0; font-size: 16px; font-weight: 500; }
.qty-nums .main dd { font-weight: 700; color: var(--teal); }
.qty-actions { display: grid; gap: 8px; }
.mini { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.mini input { padding: 8px 10px; font-size: 14px; }

.num.pos { color: var(--ok); }
.num.neg { color: var(--danger); }

.danger-zone { margin-top: 8px; padding: 14px 18px; border: 1px dashed var(--rule); border-radius: var(--r-lg); color: var(--ink-2); max-width: 640px; }
.danger-zone summary { cursor: pointer; font-weight: 500; }
.danger-zone p { margin: 10px 0; font-size: 14px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }

@media (max-width: 900px) {
  .qty-item { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 760px) {
  .stock-summary { gap: 10px 20px; }
  .stock-table th:nth-child(4), .stock-table td:nth-child(4),
  .stock-table th:nth-child(5), .stock-table td:nth-child(5),
  .stock-table th:nth-child(6), .stock-table td:nth-child(6) { display: none; }
  .v-head { display: none; }
  .v-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--rule-2); border-radius: var(--r-md); }
  .v-row input[name=v_label] { grid-column: 1 / -1; }
  .qty-nums { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* الأرقام بالجداول تصطف مثل عناوينها */
td.num, dd.num { text-align: right; }
@media (max-width: 760px) {
  .v-row input[name=v_alert] { display: none; }
  .stock-table .chips { margin-top: 6px; }
}

/* صور المنتجات */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
legend i { font-style: normal; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-inline-start: 4px; }
.photo-field { display: flex; gap: 16px; align-items: center; }
.photo-drop {
  width: 112px; height: 112px; flex: none; border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--rule); background: var(--paper); display: grid; place-items: center;
}
.photo-drop:hover { border-color: var(--teal); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: grid; justify-items: center; gap: 2px; color: var(--ink-3); text-align: center; }
.photo-empty b { font-size: 13px; color: var(--ink-2); }
.photo-empty small { font-size: 11px; }
.photo-help { display: grid; gap: 8px; justify-items: start; }
.photo-help .btn { cursor: pointer; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: auto; accent-color: var(--danger); }
#image:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; }

.product-cell { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.product-cell:hover b { color: var(--teal); text-decoration: underline; }
.product-cell > span { display: grid; }
.thumb { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; flex: none; background: var(--paper); border: 1px solid var(--rule-2); }
.thumb.is-empty { display: grid; place-items: center; color: var(--ink-3); font-weight: 600; }

/* الزبائن */
select, textarea {
  width: 100%; font: 400 15px/1.4 var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-md); padding: 12px 13px;
}
select { appearance: none; -webkit-appearance: none; padding-inline-start: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(-45deg, transparent 50%, var(--ink-3) 50%);
  background-position: 14px 52%, 19px 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
select:hover, textarea:hover { border-color: var(--ink-3); }
select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
textarea::placeholder { color: var(--ink-3); }

.pill.is-vip { background: var(--gold-soft); color: var(--gold); }
.pill.is-bad { background: var(--danger-soft); color: var(--danger); }
.pill.is-dark { background: var(--st-cancelled); color: #fff; }

.cust-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cust-tools .search { margin: 0; flex: 1 1 260px; }
.filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--rule-2); border-radius: 999px; }
.filter-item { padding: 6px 13px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.filter-item span { font-size: 12px; color: var(--ink-3); }
.filter-item:hover { color: var(--ink); }
.filter-item.is-active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(23,32,58,.08); }

.avatar { border-radius: 50%; background: var(--teal-soft); color: var(--teal); border: 0; }
.cust-table td { vertical-align: middle; }
.cust-table td:last-child { white-space: nowrap; }
.cust-table td:last-child .pill { margin-inline-start: 6px; }
.cust-table tr.is-returns td:first-child { box-shadow: inset -3px 0 0 var(--st-returned); }
.cust-table tr.is-blocked td:first-child { box-shadow: inset -3px 0 0 var(--st-cancelled); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 8px; }

.cust-head { display: grid; gap: 18px; margin-bottom: 16px; }
.cust-id { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.cust-id > div:nth-child(2) { display: grid; gap: 1px; }
.cust-id b { font-size: 18px; font-weight: 600; }
.cust-id a { color: var(--ink-2); text-decoration: none; justify-self: start; }
.cust-id a:hover { color: var(--teal); }
.cust-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.avatar-lg { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--teal-soft); color: var(--teal); font-size: 22px; font-weight: 600; }
.cust-nums { padding-top: 16px; border-top: 1px solid var(--rule-2); }
.cust-form { margin-bottom: 16px; }
.cust-danger { display: grid; gap: 10px; }

@media (max-width: 760px) {
  .cust-table th:nth-child(4), .cust-table td:nth-child(4),
  .cust-table th:nth-child(5), .cust-table td:nth-child(5),
  .cust-table th:nth-child(6), .cust-table td:nth-child(6),
  .cust-table th:nth-child(2), .cust-table td:nth-child(2) { display: none; }
  .cust-tags { margin-inline-start: 0; width: 100%; }
  .filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .filter-item { white-space: nowrap; }
  .cust-table td:last-child { white-space: normal; }
  .cust-table td:last-child .pill { display: flex; width: max-content; margin: 4px 0 0; }
  .cust-table td:last-child .num { font-size: 13px; }
}

/* =====================================================================
   الطلبات
   ===================================================================== */
.notice.is-warn { background: var(--warn-soft); color: var(--warn); flex-direction: row; align-items: center; gap: 8px; margin-bottom: 14px; }
.notice-link { text-decoration: none; }
.notice-link:hover { text-decoration: underline; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.neg { color: var(--danger); }

.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.status-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: 13.5px; text-decoration: none;
}
.status-tab span { font-size: 12px; color: var(--ink-3); }
.status-tab:hover { border-color: var(--ink-3); color: var(--ink); }
.status-tab.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 500; }
.status-tab.is-active span { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.tools-end { display: flex; gap: 8px; align-items: center; flex: 1 1 360px; justify-content: flex-end; }
.tools-end .search { margin: 0; flex: 1; max-width: 380px; }

.orders-table td { vertical-align: middle; }
.orders-table .seq { display: grid; text-decoration: none; color: var(--ink); line-height: 1.3; }
.orders-table .seq small { font-size: 11.5px; color: var(--ink-3); }
.orders-table .seq:hover b { color: var(--teal); }
.orders-table .products-cell { max-width: 240px; font-size: 13.5px; color: var(--ink-2); }
.orders-table td.strong { font-weight: 600; }

/* فورم الطلب */
.order-form { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.order-main { display: grid; gap: 16px; }
.order-side { display: grid; gap: 12px; position: sticky; top: 16px; }
.order-form fieldset + fieldset { margin-top: 6px; }
.cust-hint { padding: 10px 13px; border-radius: var(--r-md); background: var(--teal-soft); color: var(--teal); font-size: 13.5px; }
.cust-hint.is-bad { background: var(--danger-soft); color: var(--danger); }
.cust-hint.is-vip { background: var(--gold-soft); color: var(--gold); }
.field-msg { color: var(--danger); }
input.is-bad { border-color: var(--danger); }

.items { display: grid; gap: 8px; }
.it-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 110px 36px; gap: 8px; align-items: center; }
.it-row input { padding: 10px 11px; }
.it-row select { padding-block: 10px; }
.it-del { width: 36px; height: 40px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-3); border-radius: var(--r-sm); font-size: 20px; cursor: pointer; line-height: 1; }
.it-del:hover { color: var(--danger); border-color: var(--danger); }
.it-warn { grid-column: 1 / -1; color: var(--warn); font-size: 12.5px; margin-top: -2px; }
#add-item { justify-self: start; }

.money-box h2 { font-size: 16px; margin: 0 0 12px; }
.calc { margin: 0; display: grid; gap: 8px; }
.calc > div { display: grid; grid-template-columns: 1fr 130px; align-items: center; gap: 10px; }
.calc dt { font-size: 14px; color: var(--ink-2); display: grid; line-height: 1.3; }
.calc dt small { font-size: 11.5px; color: var(--ink-3); }
.calc dd { margin: 0; text-align: left; }
.calc dd.num { font-weight: 500; padding-inline: 12px; }
.calc input { padding: 9px 11px; text-align: left; }
.calc .total { padding-top: 10px; border-top: 1px solid var(--rule); }
.calc .total dt { color: var(--ink); font-weight: 600; }
.calc .total input { font-weight: 700; font-size: 17px; border-color: var(--teal); }
.calc-read > div { grid-template-columns: 1fr auto; }
.calc-read .total dd { font-size: 18px; font-weight: 700; }
.calc-read { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.profit-line { margin: 14px 0 6px; padding: 10px 13px; border-radius: var(--r-md); background: var(--teal-soft); color: var(--teal); font-size: 14px; }
.profit-line b { font-size: 17px; }
.profit-line.is-neg { background: var(--danger-soft); color: var(--danger); }
.submit-box { display: grid; gap: 12px; }
.check-ok input { accent-color: var(--teal); }
.send-now { font-size: 14px; color: var(--ink); }

/* تفاصيل الطلب */
.order-head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px 28px; align-items: center; margin-bottom: 16px; }
.oh-main { display: grid; gap: 6px; justify-items: start; }
.status.big { font-size: 17px; font-weight: 600; gap: 9px; }
.status.big .dot { width: 13px; height: 13px; border-radius: 4px; }
.oh-facts { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 0; }
.oh-facts div { display: grid; gap: 1px; }
.oh-facts dt { font-size: 12px; color: var(--ink-3); }
.oh-facts dd { margin: 0; font-weight: 500; }
.oh-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.order-cols { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.order-notes { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--paper); }
.order-notes p { margin: 0; color: var(--ink-2); font-size: 14px; }
.cust-card p { margin: 0 0 8px; }
.cust-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cust-line b { font-size: 17px; }
.tel { color: var(--ink); text-decoration: none; font-weight: 500; }
.tel:hover { color: var(--teal); }
.status-box summary { cursor: pointer; font-weight: 600; }
.status-box[open] summary { margin-bottom: 12px; }
.status-form { display: grid; gap: 8px; margin-top: 10px; }
.status-form input, .status-form select { padding: 10px 11px; }
.status-form .btn { justify-self: start; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 8px 0; position: relative; }
.timeline li .dot { margin-top: 7px; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 4px; top: 22px; bottom: -6px; width: 1px; background: var(--rule); }
.timeline li div { display: grid; font-size: 14px; }
.timeline small { font-size: 12px; color: var(--ink-3); }

@media (max-width: 1080px) {
  .order-form { grid-template-columns: 1fr; }
  .order-side { position: static; }
  .order-head { grid-template-columns: 1fr; }
  .oh-actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .orders-table th:nth-child(2), .orders-table td:nth-child(2) { display: table-cell; }
  .orders-table th:nth-child(3), .orders-table td:nth-child(3),
  .orders-table th:nth-child(4), .orders-table td:nth-child(4),
  .orders-table th:nth-child(7), .orders-table td:nth-child(7) { display: none; }
  .items-table th:nth-child(2), .items-table td:nth-child(2) { display: table-cell; }
  .orders-table .status { white-space: nowrap; font-size: 12.5px; gap: 5px; }
  .orders-table td { padding-inline: 5px; }
  .status-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-inline: -4px; padding-inline: 4px; }
  .status-tab { white-space: nowrap; }
  .tools-end { flex-wrap: wrap; justify-content: stretch; }
  .tools-end .search { max-width: none; flex: 1 1 100%; }
  .it-row { grid-template-columns: 1fr 1.4fr 40px; gap: 6px; padding: 10px; border: 1px solid var(--rule-2); border-radius: var(--r-md); }
  .it-row select { grid-column: 1 / -1; }
  .calc > div { grid-template-columns: 1fr 140px; }
}
.delete-form { display: grid; gap: 10px; justify-items: start; }
.order-cols .danger-zone { max-width: none; margin-top: 0; }

/* =====================================================================
   الحسابات
   ===================================================================== */
.acc-hint { margin-top: 12px; }
.acc-stats { gap: 10px 26px; }
.acc-stats b { font-size: 19px; }
.cat-chips { margin-bottom: 12px; }
.exp-table td, .days-table td { vertical-align: middle; }
.exp-table td.strong, .days-table td.strong { font-weight: 600; }
.inline-del { margin: 0; }
.inline-del .it-del { width: 30px; height: 30px; font-size: 17px; }
.exp-form h2, .rate-form h2 { font-size: 16px; margin: 0 0 4px; }
.exp-form, .rate-form { display: grid; gap: 12px; }
.money-in { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.cur-toggle { display: flex; padding: 3px; background: var(--rule-2); border-radius: var(--r-md); }
.cur-toggle label { cursor: pointer; }
.cur-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cur-toggle span { display: block; padding: 8px 12px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.cur-toggle input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(23,32,58,.1); }
.cur-toggle input:focus-visible + span { outline: 2px solid var(--teal); }
#exp-preview { color: var(--teal); font-weight: 500; min-height: 0; }
#exp-preview:empty { display: none; }
@media (max-width: 760px) {
  .days-table th:nth-child(2), .days-table td:nth-child(2) { display: table-cell; }
  .days-table th:nth-child(5), .days-table td:nth-child(5),
  .days-table th:nth-child(6), .days-table td:nth-child(6) { display: none; }
  .exp-table th:nth-child(2), .exp-table td:nth-child(2) { display: table-cell; }
  .exp-table th:nth-child(4), .exp-table td:nth-child(4) { display: none; }
  .topbar-meta .filters { width: 100%; }
}
.exp-table tr.is-more { display: none; }
.exp-table.show-all tr.is-more { display: table-row; }
.show-more { margin-top: 10px; }
@media (max-width: 1080px) {
  .acc-cols > .stack:last-child { order: -1; }
}

/* =====================================================================
   الإعدادات
   ===================================================================== */
.settings-tabs { margin-bottom: 16px; }
.settings-form { max-width: 760px; display: grid; gap: 14px; margin-bottom: 16px; }
.settings-form h2 { font-size: 16px; margin: 0; }
.settings-form > .btn:not(.btn-block) { justify-self: start; }
.field.narrow { max-width: 280px; }
.readonly { padding: 12px 13px; border-radius: var(--r-md); background: var(--rule-2); color: var(--ink-2); text-align: left; }
.switch { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; cursor: pointer; margin-top: 6px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 42px; height: 24px; border-radius: 999px; background: var(--rule); position: relative; transition: background .15s; margin-top: 2px; }
.switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: inset-inline-start .15s; }
.switch input:checked + .switch-ui { background: var(--teal); }
.switch input:checked + .switch-ui::after { inset-inline-start: 21px; }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--teal); outline-offset: 2px; }
.switch > span:last-child { display: grid; gap: 2px; }
.switch small { color: var(--ink-3); font-size: 13px; line-height: 1.5; }

.team { list-style: none; margin: 0 0 12px; padding: 0; display: grid; }
.team li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--rule-2); }
.team li:first-child { border-top: 0; padding-top: 0; }
.team li.is-off { opacity: .6; }
.avatar-lg.sm { width: 40px; height: 40px; font-size: 16px; }
.team-main { display: grid; gap: 2px; }
.team-main small { color: var(--ink-3); justify-self: start; }
.team-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.team-actions summary { cursor: pointer; font-size: 13.5px; color: var(--teal); padding: 4px 0; }
.team-actions[open] { grid-column: 1 / -1; }
.team-forms { display: grid; gap: 8px; margin-top: 8px; padding: 12px; background: var(--paper); border-radius: var(--r-md); }
.team-forms .mini select { padding: 8px 10px; }

.courier-settings { margin-bottom: 16px; display: grid; gap: 14px; }
.courier-settings .panel-head { margin-bottom: 0; flex-wrap: wrap; }
.courier-settings h2 small { font-weight: 400; font-size: 13px; }
.courier-settings form.fields { display: grid; gap: 12px; }
.courier-settings form.fields > .btn { justify-self: start; }
.courier-settings .danger-zone { max-width: none; margin: 0; }
.city-fees summary { cursor: pointer; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.city-fees[open] summary { margin-bottom: 8px; }
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.city-fee { display: grid; grid-template-columns: 1fr 96px; gap: 8px; align-items: center; font-size: 14px; }
.city-fee input { padding: 8px 10px; }
.m-settings { display: none; }
@media (max-width: 760px) {
  .topbar { position: relative; }
  .m-settings { display: grid; place-items: center; position: absolute; top: 18px; inset-inline-end: 0; width: 40px; height: 40px;
    border-radius: 50%; color: var(--ink-2); background: var(--surface); border: 1px solid var(--rule); }
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .team li { grid-template-columns: auto 1fr; }
  .team-actions { grid-column: 1 / -1; }
}

/* ربط برايم */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin: 0; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
#prime-form select { width: 100%; }

/* تلكرام */
.tg-step .panel-head h2 { display: flex; align-items: center; gap: 10px; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--teal); color: #fff; font-size: 14px; font-weight: 700; }
.tg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 6px; }
.code-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px dashed var(--rule); font-size: 14px; }
.code-chip code { font-weight: 700; letter-spacing: .08em; user-select: all; }
.inline-form { margin-top: 10px; }
.tg-team li { align-items: center; }
.tg-team small bdi { word-break: break-all; }

/* ===================== لوحة الإدارة ===================== */
.admin-shell { min-height: 100vh; background: var(--paper); }
.admin-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 28px; background: var(--ink); color: #fff; }
.admin-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.admin-brand b { font-weight: 500; font-size: 15px; opacity: .85; }
.admin-nav { display: flex; gap: 6px; }
.admin-nav a { color: rgba(255,255,255,.75); text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: 14px; }
.admin-nav a.is-active, .admin-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.admin-main { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.admin-head h1 { font-size: 24px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-head p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-lg); color: var(--ink); text-decoration: none; }
a.kpi:hover { border-color: var(--ink-3); }
.kpi span { font-size: 13px; color: var(--ink-3); }
.kpi b { font-size: 28px; font-weight: 600; line-height: 1.15; }
.kpi small { font-size: 12.5px; color: var(--ink-2); }
.kpi.is-ok b { color: var(--ok); }
.kpi.is-warn { background: var(--warn-soft); border-color: transparent; } .kpi.is-warn b { color: var(--warn); }
.kpi.is-bad b { color: var(--danger); }
.admin-filter { display: flex; gap: 8px; margin-bottom: 12px; }
.admin-filter input[type=search] { flex: 1; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); font: inherit; background: var(--surface); }
.table-wrap { overflow-x: auto; }
.admin-table td { vertical-align: middle; }
.admin-table .m-name { color: var(--ink); text-decoration: none; display: block; }
.admin-table .m-name:hover b { color: var(--teal); }
.admin-table small { display: block; margin-top: 2px; }
.admin-table .links .pill { margin: 2px 0 2px 4px; }
.st-pill.st-active { background: var(--ok-soft); color: var(--ok); }
.st-pill.st-trial { background: var(--teal-soft); color: var(--teal); }
.st-pill.st-past_due { background: var(--warn-soft); color: var(--warn); }
.st-pill.st-suspended { background: var(--danger-soft); color: var(--danger); }
.st-pill.st-cancelled { background: var(--st-cancelled); color: #fff; }
.renew-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.renew-form .field { margin: 0; }
.renew-form select, .renew-form input { width: 100%; }
.subs-table { margin-top: 16px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-actions .inline-form { margin: 0; display: flex; gap: 8px; align-items: center; }
.admin-actions input { padding: 9px 12px; border: 1px solid var(--rule); border-radius: var(--r-md); font: inherit; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0 0 12px; }
.facts div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--rule-2); padding-bottom: 6px; }
.facts dt { color: var(--ink-3); font-size: 13.5px; } .facts dd { margin: 0; font-weight: 600; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.plain-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plain-list.log li { font-size: 13px; }
.crumb { color: var(--ink-3); text-decoration: none; font-size: 14px; }
.empty { padding: 24px 0; text-align: center; }
.admin-link { margin-top: 6px; border-top: 1px solid var(--rule); padding-top: 12px; }
.suspended { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--ink); }
.suspended .ic { color: var(--danger); }
.suspended h1 { font-size: 22px; margin: 0; }
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .renew-form { grid-template-columns: 1fr 1fr; }
  .admin-main { padding: 18px 16px 50px; }
  .admin-top { padding: 10px 16px; }
  .admin-table th:nth-child(5), .admin-table td:nth-child(5), .admin-table th:nth-child(6), .admin-table td:nth-child(6) { display: none; }
}
.admin-actions .btn, .renew-form .btn { white-space: nowrap; }
@media (max-width: 900px) {
  .admin-table th:nth-child(2), .admin-table td:nth-child(2) { display: table-cell; }
  .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
}
/* التواصل ويا التاجر */
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.contact-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r-lg); min-width: 240px; }
.contact-card .muted { font-size: 12.5px; }
.big-phone { font-size: 22px; font-weight: 600; letter-spacing: .02em; }
.contact-actions { display: flex; gap: 8px; }
.btn-wa { background: #E7F7EE; color: #128C4B; border-color: transparent; }
.btn-wa:hover { background: #128C4B; color: #fff; }
.admin-table td.contact { white-space: nowrap; }
.admin-table .phone { font-weight: 600; font-size: 14.5px; display: block; margin-bottom: 6px; }
.contact-btns { display: inline-flex; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none; padding: 0; }
.icon-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.icon-btn.call { color: var(--teal); } .icon-btn.wa { color: #128C4B; }
.icon-btn.is-done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
@media (max-width: 900px) {
  .admin-table th:nth-child(3), .admin-table td:nth-child(3) { display: table-cell; }
  .admin-table th:nth-child(5), .admin-table td:nth-child(5),
  .admin-table th:nth-child(6), .admin-table td:nth-child(6),
  .admin-table th:nth-child(7), .admin-table td:nth-child(7) { display: none; }
  .admin-table .phone { font-size: 13.5px; }
  .contact-card { width: 100%; }
}
/* الشعار: MT ORDER */
.logo-mark { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.logo-sub { font-weight: 500; font-size: .78em; letter-spacing: 2px; opacity: .85; }
/* مفتاح تشغيل/إطفاء الاشتراك */
.sub-switch-form { margin: 0; }
.sub-switch { position: relative; width: 46px; height: 26px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
  background: var(--rule); transition: background .18s ease; }
.sub-switch .knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(23,32,58,.25); transition: inset-inline-start .18s ease; }
.sub-switch.is-on { background: var(--ok); }
.sub-switch.is-on .knob { inset-inline-start: 23px; }
.sub-switch:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
@media (max-width: 900px) {
  .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
  .admin-table th:nth-child(3), .admin-table td:nth-child(3) { display: table-cell; }
  .admin-table th:nth-child(8), .admin-table td:nth-child(8) { display: none; }
}
/* حالة الاشتراك للتاجر */
.sub-chip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: -6px; padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 12.5px; text-decoration: none; color: var(--ink-2); background: var(--sub-bg); }
.sub-chip b { color: var(--sub-fg); font-weight: 600; }
.sub-chip small { margin-inline-start: auto; color: var(--sub-fg); font-size: 11.5px; }
.sub-chip .dot, .sub-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sub-fg); display: inline-block; flex: none; }
.sub-active  { --sub-fg: var(--ok);     --sub-bg: var(--ok-soft); }
.sub-trial   { --sub-fg: var(--teal);   --sub-bg: var(--teal-soft); }
.sub-ending  { --sub-fg: var(--warn);   --sub-bg: var(--warn-soft); }
.sub-expired, .sub-stopped { --sub-fg: var(--danger); --sub-bg: var(--danger-soft); }
.sub-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--sub-bg);
  border: 1px solid color-mix(in srgb, var(--sub-fg) 22%, transparent); }
.sub-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sub-state { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--sub-fg); background: var(--surface, #fff); }
.sub-text { display: grid; gap: 2px; }
.sub-text b { font-weight: 600; }
.sub-text span { font-size: 13.5px; color: var(--ink-2); }
.sub-side { display: flex; align-items: center; gap: 12px; }
.sub-price { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
@media (max-width: 900px) { .sub-chip { display: none; } .sub-card { padding: 12px 14px; } .sub-side { width: 100%; justify-content: space-between; } }
/* حذف التاجر */
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px;
  padding: 14px 16px; border-radius: var(--r-md); border: 1px dashed color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-soft); }
.danger-zone > div { display: grid; gap: 3px; flex: 1 1 260px; }
.danger-zone b { color: var(--danger); font-weight: 600; }
.danger-zone small { color: var(--ink-2); font-size: 13px; line-height: 1.6; }
.st-pill.st-archived { background: var(--rule); color: var(--ink-2); }
.status-tab small { opacity: .7; }
/* استرجاع مبلغ */
.refund summary { cursor: pointer; color: var(--danger); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; list-style: none; white-space: nowrap; }
.refund summary::-webkit-details-marker { display: none; }
.refund-form { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border-radius: var(--r-sm); background: var(--danger-soft); min-width: 220px; }
.refund-form label { display: grid; gap: 4px; font-size: 13px; }
.refund-form small { font-size: 12px; color: var(--ink-2); }
.danger-zone .check { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.danger-zone .check input { width: 17px; height: 17px; accent-color: var(--danger); }
/* طلبات موقع المتجر */
.notice.site-order { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.notice.site-order > div { flex: 1 1 320px; line-height: 1.7; color: var(--ink); }
.notice.site-order b { color: var(--warn); }
.site-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 1px 7px; margin-inline-start: 6px; vertical-align: middle; }
/* إعدادات موقع المتجر */
.site-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.site-status-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 320px; }
.site-status p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
.site-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); margin-top: 7px; flex: none; }
.site-status.is-on .site-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.site-link { font-weight: 600; color: var(--teal); }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--rule); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.slug-input input { border: 0; border-radius: 0; flex: 1; min-width: 0; text-align: left; }
.slug-input i { font-style: normal; padding: 0 12px; display: grid; place-items: center; background: var(--paper); color: var(--ink-2); font-size: 14px; border-inline-start: 1px solid var(--rule); }
.logo-field { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; border: 1px solid var(--rule); flex: none; }
.logo-preview.is-empty { display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-size: 28px; font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 9px; border: 1px solid var(--rule); border-radius: 999px; cursor: pointer; font-size: 13px; background: var(--surface); }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch i { width: 18px; height: 18px; border-radius: 50%; }
.swatch:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); font-weight: 600; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.site-tips { margin-top: 16px; }
.site-tips h2 { font-size: 16px; margin: 0 0 8px; }
.site-tips ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 8px; color: var(--ink-2); font-size: 14px; line-height: 1.7; }
/* الموقع بلوحة الإدارة */
.site-admin-links { margin: 0 0 14px; font-size: 14px; overflow-wrap: anywhere; }
.site-admin-links a { color: var(--teal); font-weight: 500; }
.domain-form { align-items: end; }
.domain-form .field { flex: 1 1 220px; margin: 0; }
.dns-help { margin-top: 14px; font-size: 14px; }
.dns-help summary { cursor: pointer; color: var(--teal); font-weight: 500; }
.dns-help ol { margin: 10px 0 0; padding-inline-start: 20px; display: grid; gap: 10px; line-height: 1.7; color: var(--ink-2); }
.dns-table { margin: 8px 0; font-size: 13px; }
/* اختيار ثيم الموقع */
.theme-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.theme-pick { position: relative; display: grid; gap: 6px; padding: 10px; border: 1.5px solid var(--rule); border-radius: var(--r-md); cursor: pointer; background: var(--surface); }
.theme-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-pick:has(input:checked) { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.theme-pick:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.theme-name { display: flex; align-items: center; justify-content: space-between; }
.theme-name em { font-style: normal; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.theme-pick small { color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.theme-preview { font-size: 13px; color: var(--teal); justify-self: start; }
.theme-mock { display: grid; gap: 5px; padding: 8px; border-radius: 10px; background: var(--paper); border: 1px solid var(--rule-2); aspect-ratio: 4 / 3; align-content: start; }
.theme-mock i { display: block; border-radius: 4px; background: var(--rule); }
.mk-bar { height: 7px; }
.mk-row { display: grid; grid-template-columns: 1fr 2.4fr; gap: 5px; }
.mk-side { height: 34px; }
.mk-banner { height: 34px; background: color-mix(in srgb, var(--teal) 55%, #fff) !important; }
.mk-banner.is-wide { height: 30px; }
.mk-dots { display: flex; justify-content: center; gap: 6px; }
.mk-dots i { width: 10px; height: 10px; border-radius: 50% !important; }
.mk-title { height: 9px; width: 55%; background: var(--ink-3) !important; opacity: .5; }
.mk-line { height: 6px; width: 75%; }
.mk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mk-grid i { aspect-ratio: 1; }
.banner-list { list-style: none; padding: 0; margin: 0 0 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.banner-list li { display: grid; gap: 6px; }
.banner-list img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: 10px; border: 1px solid var(--rule); }
