/* =====================================================================
   تمام — طبقة التصميم الحديثة (مستوحاة من Shopify Polaris)
   v1.61 · بتتحمّل آخر ملف CSS وبتغيّر الـtokens والمكوّنات الأساسية بس.
   مبادئ Polaris: خلفية رمادية محايدة، بطاقات بيضاء 12px بحد رفيع، أزرار 8px
   (الأساسي أسود #303030)، شارات pill بألوان هادية، تركيز أزرق واضح، وسايدبار داكن.
   ورقة المستند (.dp) عمدًا خارج التغيير عشان هوية الشركة والطباعة.
   ===================================================================== */

@font-face { font-family: 'Inter'; src: url('../fonts/inter-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026, U+20AC, U+2190, U+2192; }

:root {
  --pl-bg: #f1f1f1;
  --pl-surface: #ffffff;
  --pl-surface-2: #f7f7f7;
  --pl-border: #e3e3e3;
  --pl-border-2: #ebebeb;
  --pl-input-border: #8a8a8a;
  --pl-text: #303030;
  --pl-text-2: #616161;
  --pl-text-3: #8a8a8a;
  --pl-primary: #303030;
  --pl-primary-hover: #1a1a1a;
  --pl-focus: #005bd3;
  --pl-side: #1a1a1a;
  --pl-side-hover: #2a2a2a;
  --pl-side-active: #303030;
  --pl-shadow-card: 0 1px 0 0 rgba(26, 26, 26, .07);
  --pl-shadow-pop: 0 8px 24px rgba(26, 26, 26, .16), 0 0 0 1px rgba(26, 26, 26, .06);

  --canvas: var(--pl-bg);
  --surface: var(--pl-surface);
  --line: var(--pl-border);
  --ink: var(--pl-text);
  --ink-2: var(--pl-text-2);
  --ink-3: var(--pl-text-3);
  --side-bg: var(--pl-side);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  --ok: #0c5132;        --ok-bg: #cdfee1;
  --warn: #5e4200;      --warn-bg: #ffe9a8;
  --danger: #8e1f0b;    --danger-bg: #fed3d1;
  --info: #003a5a;      --info-bg: #cae9ff;

  --shadow-sm: var(--pl-shadow-card);
  --shadow-md: 0 2px 8px rgba(26, 26, 26, .08);
  --shadow-lg: var(--pl-shadow-pop);

  --font: 'Inter', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-w: 244px;
}

html { background: var(--pl-bg); }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--pl-text); background: var(--pl-bg); -webkit-font-smoothing: antialiased; }
a { color: #005bd3; }
:focus-visible { outline: 2px solid var(--pl-focus); outline-offset: 1px; border-radius: 6px; }

/* ---------- السايدبار ---------- */
.sidebar { background: var(--pl-side); padding: 14px 10px; width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
.sidebar__brand, .sidebar__brand--logo { padding: 4px 10px 14px; }
.sidebar__powered, .sidebar__powered--top { opacity: .7; }
.nav { gap: 1px; }
.nav__item { padding: 7px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: #e3e3e3; gap: 10px; }
.nav__item svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.75; opacity: .85; }
.nav__item:hover { background: var(--pl-side-hover); color: #fff; }
.nav__item.is-active { background: var(--pl-side-active); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.nav__item.is-active svg { opacity: 1; }
.nav__count, .nav__count--new { background: #e3e3e3; color: #1a1a1a; font-weight: 600; }
.sidebar__footer { border-top-color: rgba(255, 255, 255, .1); }
.user-chip__name { color: #f1f1f1; }
.user-chip__role { color: #b5b5b5; }
.avatar { background: #4a4a4a; color: #fff; }

/* ---------- الشريط العلوي والمحتوى ---------- */
.topbar { background: var(--pl-bg); border-bottom: 0; padding: 10px 24px; }
.content { padding: 8px 24px 40px; max-width: 1360px; }
.breadcrumb, .topbar a, .topbar .small { color: var(--pl-text-2); }

.page-head h1, .sl-head h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.sl-head { margin-bottom: 14px; }
.sl-head__brand img { width: 26px; height: 26px; border-radius: 7px; }
.sl-head__sub { color: var(--pl-text-2); }
.ct-chip, .sl-head h1 span { border-radius: 6px; }

/* ---------- البطاقات ---------- */
.card, .stat, .app-card { background: var(--pl-surface); border: 1px solid var(--pl-border); border-radius: 12px; box-shadow: var(--pl-shadow-card); }
.card { padding: 16px 20px; }
.card + .card { margin-top: 16px; }
.card__title { font-size: 14px; font-weight: 650; }
.stat { padding: 14px 16px; }
.stat__label { color: var(--pl-text-2); font-size: 12.5px; font-weight: 500; }
.stat__value { font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
.grid { gap: 16px; }

/* ---------- الأزرار ---------- */
.btn { border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 550; line-height: 1.3; border: 1px solid transparent; box-shadow: none; transition: background .12s, box-shadow .12s, transform .05s; }
.btn:active { transform: translateY(.5px); }
.btn--primary, .btn--accent { background: var(--pl-primary); color: #fff; border-color: var(--pl-primary); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 0 rgba(26, 26, 26, .4); }
.btn--primary:hover, .btn--accent:hover { background: var(--pl-primary-hover); border-color: var(--pl-primary-hover); }
.btn--ghost, .btn--light { background: #fdfdfd; color: var(--pl-text); border: 1px solid #d6d6d6; box-shadow: 0 1px 0 rgba(26, 26, 26, .07), inset 0 -1px 0 rgba(0, 0, 0, .06); }
.btn--ghost:hover, .btn--light:hover { background: #f7f7f7; border-color: #c9c9c9; }
.btn--danger { background: #fdfdfd; color: #8e1f0b; border: 1px solid #e0b3ae; }
.btn--danger:hover { background: #fff1f0; border-color: #c9372c; }
.btn--sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn--lg { padding: 11px 22px; font-size: 14.5px; }
.btn--ghost-light { border-radius: 8px; }
.btn[disabled], .btn:disabled { opacity: .5; box-shadow: none; }

/* ---------- الحقول ---------- */
.field__label { font-size: 13px; font-weight: 550; color: var(--pl-text); margin-bottom: 4px; }
.field__hint { color: var(--pl-text-2); }
.input, .select, .textarea { background: #fff; border: 1px solid var(--pl-input-border); border-radius: 8px; padding: 7px 11px; font-size: 14px; color: var(--pl-text); box-shadow: inset 0 1px 0 rgba(26, 26, 26, .04); transition: border-color .12s, box-shadow .12s; }
.input:hover, .select:hover, .textarea:hover { border-color: #616161; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--pl-focus); outline-offset: 1px; border-color: var(--pl-focus); box-shadow: none; }
.input::placeholder, .textarea::placeholder { color: #8a8a8a; }
.input--sm { padding: 4px 9px; font-size: 13px; }

/* ---------- الشارات (Polaris badges) ---------- */
.badge { border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 550; gap: 5px; line-height: 1.5; background: #e3e3e3; color: #4a4a4a; }
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; border: 1.5px solid currentColor; opacity: .75; }
.badge--ok { background: #cdfee1; color: #0c5132; }
.badge--warn { background: #ffd6a4; color: #5e3a00; }
.badge--danger { background: #fed3d1; color: #8e1f0b; }
.badge--info { background: #cae9ff; color: #003a5a; }
.badge--muted { background: #e3e3e3; color: #4a4a4a; }
.badge--new { background: #e0f0ff; color: #003a5a; }
.soon-tag { border-radius: 6px; }

/* ---------- التبويبات والفلاتر ---------- */
.tabs, .sl-stages { gap: 4px; }
.tabs__item { border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--pl-text-2); padding: 5px 11px; font-size: 13px; font-weight: 550; }
.tabs__item:hover { background: #ebebeb; color: var(--pl-text); }
.tabs__item.is-active { background: #e3e3e3; color: var(--pl-text); border-color: transparent; box-shadow: none; }
.tabs__item b { background: #ebebeb; color: var(--pl-text-2); border-radius: 6px; padding: 0 6px; font-size: 11.5px; }
.tabs__item.is-active b { background: #fff; color: var(--pl-text); }
.chip, .pill { border-radius: 8px; }

/* ---------- الجداول والقوائم ---------- */
.table { font-size: 13.5px; }
.table th { background: var(--pl-surface-2); color: var(--pl-text-2); font-weight: 550; font-size: 12.5px; border-bottom: 1px solid var(--pl-border); padding: 9px 12px; }
.table td { border-bottom: 1px solid var(--pl-border-2); padding: 10px 12px; }
.table tr:hover td { background: #fafafa; }
.sl-list { padding: 0; overflow: hidden; }
.sl-rows { display: block; }
.dc-row { border-bottom: 1px solid var(--pl-border-2); padding: 10px 16px; transition: background .1s; }
.dc-row:hover { background: #f7f7f7; }
.dc-row--head { background: var(--pl-surface-2); color: var(--pl-text-2); font-size: 12.5px; font-weight: 550; border-bottom: 1px solid var(--pl-border); }
.dc-row--head:hover { background: var(--pl-surface-2); }
.dc-row__main b { font-weight: 550; }
.sl-strip { background: var(--pl-border); border: 1px solid var(--pl-border); border-radius: 12px; box-shadow: var(--pl-shadow-card); overflow: hidden; }
.sl-strip > div { background: #fff; }
.sl-strip b { font-weight: 650; letter-spacing: -.01em; }
.sl-pager { border-top: 1px solid var(--pl-border-2); }
.sl-filter .input { background: #fff; }

/* ---------- التنبيهات ---------- */
.alert { border-radius: 12px; border: 1px solid transparent; padding: 11px 14px; font-size: 13.5px; }
.alert--success { background: #cdfee1; color: #0c5132; border-color: #a6e8c2; }
.alert--error { background: #fed3d1; color: #8e1f0b; border-color: #f2b0ab; }
.alert--info { background: #e0f0ff; color: #003a5a; border-color: #b5dcff; }
.alert--warning { background: #ffe9a8; color: #5e4200; border-color: #f3d36b; }
.alert--update { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.alert--update a { color: #fff; }

/* ---------- النوافذ ---------- */
.modal__box { border-radius: 16px; box-shadow: var(--pl-shadow-pop); border: 0; }
.modal__head h2 { font-size: 16px; font-weight: 650; }
.modal__close { border-radius: 8px; }

/* ---------- لوحة التحكم ---------- */
.dash-hero { background: #1a1a1a; border-radius: 12px; box-shadow: var(--pl-shadow-card); }
.dash-hero__glow { display: none; }
.dash-hero__title { font-size: 24px; font-weight: 650; }
.dash-hero__stat { border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); }
.dash-chip { border-radius: 8px; }
.dash-chip--plan { background: #e3e3e3; color: #1a1a1a; }
.dash-quick .btn { border-radius: 8px; }
.empty { padding: 36px 20px; }
.empty__title { font-weight: 650; }

/* ---------- الاحتياجات الصغيرة ---------- */
hr { border: 0; border-top: 1px solid var(--pl-border); }
.dc-link .input { background: #f7f7f7; }
.avatar--light { background: #e3e3e3; color: #303030; }
.dc-card { box-shadow: var(--pl-shadow-card); }
.hr-profile, .app-card { border-radius: 12px; }
::selection { background: #cae9ff; }

/* ---------- رقم الإصدار داخل التطبيق ---------- */
.app-ver { display: block; margin: 8px 10px 0; font-size: 11.5px; color: #8a8a8a; letter-spacing: .02em; }
.app-ver a { color: inherit; }
.app-ver a:hover { color: #e3e3e3; }

/* ---------- صفحات الدخول والعامة ---------- */
.auth, .auth__panel, .auth-form-side { background: var(--pl-bg); }
.shr-body { background: var(--pl-bg); }
.dpub__bar, .dpub__decide { border-radius: 12px; border-color: var(--pl-border); box-shadow: var(--pl-shadow-card); }

/* ---------- صفحة الدخول ---------- */
.auth2 { background: var(--pl-bg); }
.auth2__aside { background: #1a1a1a; }
.auth2__title { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }
.auth2__form { background: #fff; border: 1px solid var(--pl-border); border-radius: 16px; padding: 28px; box-shadow: var(--pl-shadow-card); }
.auth2__tick, .auth2__mock-ok { background: #fff; color: #1a1a1a; }
.auth2__mock { border-radius: 12px; }

/* ---------- متجاوب ---------- */
@media (max-width: 860px) {
  .content { padding: 8px 14px 32px; }
  .topbar { padding: 8px 14px; }
}
@media print {
  body, html { background: #fff !important; }
}
.auth2__aside::before, .auth2__aside::after, .auth2__glow { display: none !important; }

/* ثيم الشركة (white-label) بيحقن لون للتبويب النشط بعد الملفات — نثبّت نمط Polaris عشان النص ميبقاش غامق على خلفية غامقة */
.tabs__item.is-active, .tabs__item.is-active:hover { background: #e3e3e3 !important; color: #303030 !important; border-color: transparent !important; }
.tabs__item.is-active b { background: #fff !important; color: #303030 !important; }

/* بدون إيموجي: أيقونات القوالب الزخرفية مخفية */
.tpl-card__icon { display: none; }

/* ---------- الشركات: بروفايل لكل شركة ---------- */
.co-av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; font-weight: 650; font-size: 15px; flex: none; }
.co-av--sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.co-av--lg { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }
.co-av--plus { background: #e3e3e3 !important; color: #303030; font-size: 30px; font-weight: 400; }
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.co-grid--lg { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.co-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 22px 16px; background: #fff; border: 1px solid var(--pl-border); border-radius: 16px; box-shadow: var(--pl-shadow-card); font: inherit; color: inherit; width: 100%; }
.co-card.is-current { border-color: #303030; box-shadow: 0 0 0 1px #303030; }
.co-card__name { font-size: 16px; font-weight: 650; }
.co-card__meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.co-card--add { border-style: dashed; background: #fafafa; }
.co-card--add .input { text-align: center; }
.co-card--pick { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.co-card--pick:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26,26,26,.14); }
.co-card--pick small { color: var(--pl-text-2); }
.co-pick { min-height: 100vh; display: grid; place-items: center; background: var(--pl-bg); padding: 24px; }
.co-pick__in { width: 100%; max-width: 760px; text-align: center; }
.co-pick h1 { margin: 18px 0 4px; font-size: 26px; font-weight: 650; }
.co-pick__sub { color: var(--pl-text-2); margin: 0 0 24px; }
.co-pick__out { margin-top: 28px; }
.co-dd { position: relative; }
.co-dd__btn { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px 4px 6px; background: #fff; border: 1px solid #d6d6d6; border-radius: 10px; box-shadow: 0 1px 0 rgba(26,26,26,.07); }
.co-dd__btn::-webkit-details-marker { display: none; }
.co-dd__btn b { font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-dd__menu { position: absolute; z-index: 60; inset-inline-start: 0; top: calc(100% + 6px); min-width: 250px; background: #fff; border-radius: 12px; box-shadow: var(--pl-shadow-pop); padding: 6px; }
.co-dd__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; font: inherit; text-align: start; cursor: pointer; }
.co-dd__item:hover, .co-dd__item.is-on { background: #f1f1f1; }
.co-dd__item i { margin-inline-start: auto; font-style: normal; color: #0c5132; }
.co-dd__all { display: block; padding: 8px 10px; margin-top: 4px; border-top: 1px solid var(--pl-border-2); font-size: 13px; color: #005bd3; }
.topbar__title .co-dd span::before, .topbar__title .co-dd span::after { content: none !important; }
.topbar__title .co-dd span { margin: 0; padding: 0; }

/* ---------- توحيد شامل (v1.65) ---------- */
:root { --brand-tint: #f7f7f7; --brand-light: #ebebeb; }
input[type="checkbox"], input[type="radio"], progress { accent-color: #303030; }
.sl-head__brand h1:not(.mod-brand) span, .sl-head__brand h1:not(.mod-brand) span.ct-chip { background: #e3e3e3 !important; color: #303030 !important; border-radius: 6px; font-size: .62em; padding: 3px 9px; letter-spacing: 0; vertical-align: middle; }
.tpl-card { border-top: 1px solid var(--pl-border) !important; border-radius: 12px; }
.tpl-card:hover { box-shadow: var(--pl-shadow-pop); transform: translateY(-1px); }
.tpl-card__go { color: #005bd3 !important; }
.mg-hero, .ads-hero, .dash-hero { background: #1a1a1a !important; border-radius: 12px; }
.tai__fab { background: #303030 !important; box-shadow: 0 4px 16px rgba(26, 26, 26, .28); font-weight: 600; }
.tai__fab:hover { background: #1a1a1a !important; }
.tai__spark { color: #fff; }
.sl-strip b { color: var(--pl-text); }
.badge--new { background: #e0f0ff !important; color: #003a5a !important; }
.nav__item--soon .soon-tag, .soon-tag { background: #e3e3e3; color: #4a4a4a; }
.pj-tree__row.is-active, .fmenu > summary.is-on, .iconbtn:hover { background: #ebebeb; border-color: #c9c9c9; }
.update.is-new { border-color: #b5dcff; box-shadow: 0 0 0 3px #e0f0ff; }
.choice__option:has(input:checked), .pm-chip.is-on, .dropzone:hover, .version.is-current { border-color: #303030; background: #f7f7f7; }
.btn--ghost:hover:not(:disabled) { background: #f7f7f7; border-color: #c9c9c9; }
.avatar--light { background: #e3e3e3; color: #303030; }
.nav__count--new { background: #e3e3e3; color: #1a1a1a; }
.modal { background: rgba(26, 26, 26, .45); backdrop-filter: blur(2px); }
.table-wrap { border-radius: 12px; }
h1, h2, h3 { letter-spacing: -.005em; }
@media (max-width: 860px) {
  .card { padding: 14px 14px; border-radius: 12px; }
  .co-grid, .co-grid--lg { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ---------- بوابة العميل بنفس اللغة ---------- */
.pt-notch { background: var(--side-bg, #1a1a1a); }
.pt-frame { background: #fff; border: 1px solid var(--pl-border); border-radius: 16px; box-shadow: var(--pl-shadow-card); }
.pt-dock { background: #fff; border: 1px solid var(--pl-border); box-shadow: var(--pl-shadow-card); }
.pt-dock__item { border-radius: 12px; }
.pt-tile, .pt-brandcard { background: #f7f7f7; border: 1px solid var(--pl-border-2); border-radius: 12px; }
.pt-tile--hot { background: #303030 !important; border-color: #303030; }
.pt-box { border-radius: 12px; border-color: var(--pl-border); }
.pt-hero { background: #1a1a1a !important; border-radius: 12px; }
.pt-hero__cta { background: #fff !important; color: #1a1a1a !important; border-radius: 8px; font-weight: 600; }
.pt-hero__mono { background: #fff; color: #1a1a1a; }
.pt-bell { background: #fff; border-color: var(--pl-border); }
