/* =====================================================================
   تمام (Tamam) — نظام التصميم
   RTL أولًا · متغيرات CSS لكل قيمة قابلة للتغيير
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  /* الألوان الأساسية */
  --brand:          #0F5C4A;
  --brand-dark:     #0A4035;
  --brand-light:    #D9EDE6;
  --brand-tint:     #F0F7F4;

  /* الحياد */
  --ink:            #14201C;
  --ink-2:          #4A5A54;
  --ink-3:          #7C8C86;
  --line:           #E2E8E5;
  --surface:        #FFFFFF;
  --canvas:         #EFF2F1;

  /* الحالات */
  --ok:             #1E7F5C;
  --ok-bg:          #E3F3EC;
  --warn:           #9A6B1F;
  --warn-bg:        #FBF0DA;
  --danger:         #A32E2E;
  --danger-bg:      #FAE7E7;
  --info:           #2B5C8A;
  --info-bg:        #E6EEF6;

  /* المقاييس */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-pill: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --shadow-sm: 0 1px 2px rgba(20, 32, 28, .06);
  --shadow-md: 0 4px 16px rgba(20, 32, 28, .08);
  --shadow-lg: 0 12px 32px rgba(20, 32, 28, .12);

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

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }

/* ---------- التخطيط ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: #fff;
  padding: var(--sp-5) var(--sp-4);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  padding: 0 var(--sp-3) var(--sp-5);
  letter-spacing: -.5px;
}
.sidebar__brand:hover { text-decoration: none; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  color: rgba(255,255,255,.72);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav__item.is-active { background: var(--brand); color: #fff; }
.nav__item svg { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar__footer {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: var(--sp-4);
  margin-top: var(--sp-4);
}

.user-chip { display: flex; align-items: center; gap: var(--sp-3); }
.user-chip__meta { min-width: 0; flex: 1; }
.user-chip__name {
  font-size: 14px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip__role { font-size: 12px; color: rgba(255,255,255,.55); }

.avatar {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
}
.avatar--sm { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }
.avatar--light { background: var(--brand-light); color: var(--brand-dark); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.content { padding: var(--sp-6); flex: 1; max-width: 1280px; width: 100%; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.page-head__sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }

/* ---------- البطاقات ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.card + .card { margin-top: var(--sp-4); }
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.card__title { font-size: 16px; font-weight: 600; }

.grid { display: grid; gap: var(--sp-4); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

/* ---------- بطاقات الإحصاء ---------- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-5); }
.stat__label { font-size: 13px; color: var(--ink-2); margin-bottom: var(--sp-2); }
.stat__value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat__value--ok { color: var(--ok); }
.stat__value--warn { color: var(--warn); }
.stat__hint { font-size: 12px; color: var(--ink-3); margin-top: var(--sp-1); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: var(--brand-tint); border-color: var(--brand-light); }

.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--danger-bg); }

.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--block { width: 100%; }

/* ---------- النماذج ---------- */
.field { margin-bottom: var(--sp-4); }
.field__label { display: block; font-size: 13px; font-weight: 600; margin-bottom: var(--sp-2); }
.field__hint { font-size: 12px; color: var(--ink-3); margin-top: var(--sp-2); line-height: 1.5; }
.field__error { font-size: 12px; color: var(--danger); margin-top: var(--sp-2); }

.input, .select, .textarea {
  width: 100%;
  padding: 11px var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.input.has-error, .select.has-error { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237C8C86' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left var(--sp-4) center;
  padding-left: var(--sp-6);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

/* اختيار الدور كبطاقات */
.choice { display: grid; gap: var(--sp-3); }
.choice__option {
  display: block;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice__option:hover { border-color: var(--brand-light); }
.choice__option input { position: absolute; opacity: 0; pointer-events: none; }
.choice__option:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.choice__title { font-weight: 600; font-size: 14px; }
.choice__desc { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.55; }

/* ---------- الجداول ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: right;
  font-size: 12px; font-weight: 600;
  color: var(--ink-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--brand-tint); }
.table__actions { display: flex; gap: var(--sp-2); justify-content: flex-start; }

/* ---------- الشارات ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge--ok     { background: var(--ok-bg);     color: var(--ok); }
.badge--warn   { background: var(--warn-bg);   color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info   { background: var(--info-bg);   color: var(--info); }
.badge--muted  { background: var(--canvas);    color: var(--ink-2); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- التنبيهات ---------- */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 14px;
  margin-bottom: var(--sp-4);
  border: 1px solid transparent;
}
.alert--success { background: var(--ok-bg);     color: var(--ok);     border-color: #BEE3D2; }
.alert--error   { background: var(--danger-bg); color: var(--danger); border-color: #F0C9C9; }
.alert--info    { background: var(--info-bg);   color: var(--info);   border-color: #C9DCEC; }

/* ---------- الحالة الفارغة ---------- */
.empty { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--ink-2); }
.empty__icon { width: 44px; height: 44px; margin: 0 auto var(--sp-4); color: var(--ink-3); opacity: .6; }
.empty__title { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: var(--sp-2); }
.empty__text { font-size: 14px; margin-bottom: var(--sp-4); }

/* ---------- شاشات المصادقة ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--canvas);
}
.auth__box { width: 100%; max-width: 420px; }
.auth__brand {
  text-align: center;
  font-size: 30px; font-weight: 700;
  color: var(--brand);
  margin-bottom: var(--sp-2);
  letter-spacing: -1px;
}
.auth__tagline { text-align: center; color: var(--ink-2); font-size: 14px; margin-bottom: var(--sp-5); }
.auth__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-md);
}
.auth__title { font-size: 20px; margin-bottom: var(--sp-5); }
.auth__foot { text-align: center; margin-top: var(--sp-5); font-size: 14px; color: var(--ink-2); }

/* ---------- الحوارات ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(20, 32, 28, .55);
  display: none;
  place-items: center;
  padding: var(--sp-5);
  z-index: 100;
}
.modal.is-open { display: grid; }
.modal__box {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  padding: var(--sp-6);
  box-shadow: var(--shadow-lg);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); }
.modal__close {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--ink-3); line-height: 1;
  padding: var(--sp-1);
}
.modal__foot { display: flex; gap: var(--sp-3); justify-content: flex-start; margin-top: var(--sp-5); }

/* ---------- سجل النشاط ---------- */
.feed { display: flex; flex-direction: column; gap: var(--sp-4); }
.feed__item { display: flex; gap: var(--sp-3); align-items: flex-start; }
.feed__body { flex: 1; min-width: 0; }
.feed__text { font-size: 14px; }
.feed__time { font-size: 12px; color: var(--ink-3); }

/* ---------- مساعدات ---------- */
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-4 { margin-bottom: var(--sp-4); }
.flex { display: flex; align-items: center; gap: var(--sp-3); }
.flex--between { justify-content: space-between; }
.nowrap { white-space: nowrap; }

/* ---------- الموبايل ---------- */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex-basis: auto; height: auto; position: static;
    flex-direction: row; align-items: center; gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    overflow-x: auto;
  }
  .sidebar__brand { padding: 0; font-size: 19px; }
  .nav { flex-direction: row; flex: 1; gap: var(--sp-1); }
  .nav__item { padding: 8px 12px; white-space: nowrap; }
  .nav__item span { display: none; }
  .sidebar__footer { border: none; margin: 0; padding: 0; }
  .user-chip__meta { display: none; }

  .content { padding: var(--sp-4); }
  .topbar { padding: var(--sp-3) var(--sp-4); }
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  /* الجداول تتحول لبطاقات */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-3);
    padding: var(--sp-2);
  }
  .table td { border: none; padding: var(--sp-2) var(--sp-3); display: flex; justify-content: space-between; gap: var(--sp-3); }
  .table td::before {
    content: attr(data-label);
    font-size: 12px; font-weight: 600; color: var(--ink-2);
  }
  .table td:not([data-label]) { justify-content: flex-start; }
}

/* =====================================================================
   v0.2 — المشاريع والملفات
   ===================================================================== */

/* ---------- فتات الخبز ---------- */
.crumbs {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: 13px; color: var(--ink-3);
  margin-bottom: var(--sp-2);
}
.crumbs a { color: var(--ink-2); }
.crumbs a:last-of-type { color: var(--ink); font-weight: 500; }

/* ---------- التبويبات ---------- */
.tabs {
  display: flex; gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
  padding-bottom: 2px;
}
.tabs__item {
  padding: 7px 18px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tabs__item:hover { text-decoration: none; border-color: var(--brand-light); }
.tabs__item.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- بطاقة المشروع ---------- */
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: border-color .15s, box-shadow .15s;
}
.tile:hover { text-decoration: none; border-color: var(--brand-light); box-shadow: var(--shadow-sm); }
.tile__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-1);
}
.tile__title { font-size: 16px; color: var(--ink); }
.tile__meta { font-size: 13px; color: var(--ink-2); margin-bottom: var(--sp-4); }
.tile__foot {
  display: flex; justify-content: space-between; gap: var(--sp-3);
  font-size: 12.5px; color: var(--ink-3); margin-top: var(--sp-3);
}

.progress { height: 6px; background: var(--canvas); border-radius: var(--r-pill); overflow: hidden; }
.progress__bar { height: 100%; background: var(--ok); border-radius: var(--r-pill); transition: width .3s; }

/* ---------- صف قابل للنقر ---------- */
.row-link {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  margin: 0 calc(var(--sp-3) * -1);
  border-radius: var(--r-md);
  color: var(--ink);
}
.row-link:hover { text-decoration: none; background: var(--brand-tint); }

/* ---------- المجلدات ---------- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
}
.folder {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
}
.folder:hover { text-decoration: none; background: var(--brand-tint); border-color: var(--brand-light); }
.folder svg { width: 22px; height: 22px; flex: 0 0 22px; color: var(--brand); }
.folder__body { min-width: 0; }
.folder__name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.folder__count { font-size: 12px; color: var(--ink-3); }

/* ---------- شبكة الملفات ---------- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4);
}
.file-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.file-card:hover { text-decoration: none; border-color: var(--brand-light); box-shadow: var(--shadow-sm); }
.file-card__thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--canvas);
  display: grid; place-items: center;
  overflow: hidden;
}
.file-card__thumb img { width: 100%; height: 100%; object-fit: contain; }
.file-card__type { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.file-card__badge { position: absolute; top: var(--sp-2); inset-inline-start: var(--sp-2); }
.file-card__body { padding: var(--sp-3) var(--sp-4); }
.file-card__name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-card__meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- منطقة الرفع ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-4);
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-tint); }
.dropzone svg { width: 28px; height: 28px; color: var(--ink-3); }
.dropzone__title { font-size: 15px; }
.dropzone__hint { font-size: 13px; color: var(--ink-2); word-break: break-all; }

/* ---------- خانات الاختيار ---------- */
.check {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  cursor: pointer;
}
.check:hover { border-color: var(--brand-light); }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: 0 0 16px; }
.check strong { display: block; font-size: 14px; }
.check__hint { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* ---------- عارض الملف ---------- */
.viewer-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--sp-4);
  align-items: start;
}
.viewer {
  background: #1C2622;
  border-radius: var(--r-lg);
  min-height: 420px;
  display: grid; place-items: center;
  overflow: hidden;
  padding: var(--sp-4);
}
.viewer__media { max-width: 100%; max-height: 72vh; display: block; border-radius: var(--r-sm); }
.viewer__frame { width: 100%; height: 72vh; border: none; border-radius: var(--r-sm); background: #fff; }
.viewer__fallback { text-align: center; color: rgba(255,255,255,.75); padding: var(--sp-6); }
.viewer__fallback svg { width: 44px; height: 44px; margin-bottom: var(--sp-4); opacity: .5; }
.viewer__fallback .empty__title { color: #fff; }
.viewer__fallback .muted { color: rgba(255,255,255,.55); }

.viewer-side .card { padding: var(--sp-4); }
.viewer-side .card + .card { margin-top: var(--sp-3); }

/* ---------- النسخ ---------- */
.versions { display: flex; flex-direction: column; gap: var(--sp-2); }
.version {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.version.is-current { border-color: var(--brand); background: var(--brand-tint); }
.version__no { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); }
.version__meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- قائمة التفاصيل ---------- */
.details { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4); font-size: 13.5px; }
.details dt { color: var(--ink-2); }
.details dd { font-weight: 500; text-align: left; }

@media (max-width: 1024px) {
  .viewer-layout { grid-template-columns: 1fr; }
  .viewer__frame { height: 60vh; }
}

@media (max-width: 768px) {
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
  .folder-grid { grid-template-columns: 1fr; }
  .viewer { min-height: 280px; padding: var(--sp-2); }
  .viewer__media { max-height: 56vh; }
  .details { grid-template-columns: 1fr; gap: 2px var(--sp-3); }
  .details dd { text-align: right; margin-bottom: var(--sp-2); }
}

/* ---------- v0.2.1: تقدّم الرفع واللوجو ---------- */
.upload-progress { margin-bottom: var(--sp-4); }
.upload-progress .progress { height: 8px; margin-bottom: var(--sp-2); }
.upload-progress__text { font-size: 13px; color: var(--ink-2); text-align: center; }

.logo-preview {
  display: grid; place-items: center;
  padding: var(--sp-5);
  background: var(--canvas);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
  min-height: 90px;
}
.logo-preview img { max-width: 220px; max-height: 70px; object-fit: contain; }

.sidebar__brand--logo { padding: 0 var(--sp-3) var(--sp-5); display: block; }
.sidebar__brand--logo img {
  max-width: 100%; max-height: 44px; object-fit: contain; object-position: right;
  display: block;
}

@media (max-width: 768px) {
  .sidebar__brand--logo { padding: 0; }
  .sidebar__brand--logo img { max-height: 28px; max-width: 110px; }
}

/* ---------- v0.3: مقارنة النسخ ---------- */
.compare-picker { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: end; }
.compare-picker .field { margin-bottom: 0; }
.compare-modes { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.compare-modes .tabs__item { cursor: pointer; font-family: var(--font); }

/* جنب بعض */
.compare-side { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.compare-side__item { margin: 0; }
.compare-side__frame {
  background: #1C2622;
  border-radius: var(--r-md);
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  overflow: hidden;
}
.compare-side__frame img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.compare-side figcaption {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-top: var(--sp-3);
}

/* مقبض التمرير */
.compare-slider {
  position: relative;
  background: #1C2622;
  border-radius: var(--r-md);
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
  line-height: 0;
  cursor: col-resize;
}
.compare-slider__base { width: 100%; height: auto; display: block; }
.compare-slider__overlay {
  position: absolute; inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
}
.compare-slider__overlay img { height: 100%; width: auto; max-width: none; display: block; object-fit: cover; object-position: left top; }
.compare-slider__handle {
  position: absolute; top: 0; bottom: 0;
  inset-inline-start: 50%;
  width: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  cursor: col-resize;
  transform: translateX(-50%);
}
.compare-slider__handle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.compare-slider__grip {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.compare-slider__grip::before,
.compare-slider__grip::after {
  content: ''; position: absolute; top: 50%; width: 0; height: 0;
  border-block: 5px solid transparent;
}
.compare-slider__grip::before { left: 7px;  border-inline-end: 6px solid var(--ink-2); transform: translateY(-50%); }
.compare-slider__grip::after  { right: 7px; border-inline-start: 6px solid var(--ink-2); transform: translateY(-50%); }

.compare-slider__tag {
  position: absolute; bottom: var(--sp-3);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: rgba(20,32,28,.72);
  color: #fff;
  font-size: 12px; font-weight: 600;
  line-height: 1.6;
  pointer-events: none;
}
.compare-slider__tag--start { inset-inline-start: var(--sp-3); }
.compare-slider__tag--end   { inset-inline-end: var(--sp-3); }

@media (max-width: 768px) {
  .compare-picker { grid-template-columns: 1fr; }
  .compare-side { grid-template-columns: 1fr; }
}
