/* الخطوط مضمّنة في التطبيق (ترخيص OFL) فتعمل بدون إنترنت وبدون خدمات خارجية */
@font-face { font-family: "Plex AR"; font-weight: 400; font-display: swap; src: url(/fonts/plex-400.woff) format("woff"); }
@font-face { font-family: "Plex AR"; font-weight: 500; font-display: swap; src: url(/fonts/plex-500.woff) format("woff"); }
@font-face { font-family: "Plex AR"; font-weight: 600; font-display: swap; src: url(/fonts/plex-600.woff) format("woff"); }
@font-face { font-family: "Plex AR"; font-weight: 700 900; font-display: swap; src: url(/fonts/plex-700.woff) format("woff"); }
@font-face { font-family: "Tajawal AR"; font-weight: 400; font-display: swap; src: url(/fonts/tajawal-400.woff) format("woff"); }
@font-face { font-family: "Tajawal AR"; font-weight: 500 600; font-display: swap; src: url(/fonts/tajawal-500.woff) format("woff"); }
@font-face { font-family: "Tajawal AR"; font-weight: 700 900; font-display: swap; src: url(/fonts/tajawal-700.woff) format("woff"); }
@font-face { font-family: "Cairo AR"; font-weight: 400 700; font-display: swap; src: url(/fonts/cairo-var.woff) format("woff"); }
/* ملفات فاينست — ألواح وأدراج: المجلدات كواجهات أدراج بمقبض، والملفات كعينات ألواح بشريط حافة حسب النوع */

:root {
  --stone: #e4e8e3;
  --board: #f7f8f5;
  --board-2: #eceee9;
  --ink: #14221d;
  --ink-2: #4b5b54;
  --ink-3: #6b7a73;
  --line: #d2d8d0;
  --line-2: #c0c8be;
  --petrol: #0b5c59;
  --petrol-2: #0e716d;
  --on-petrol: #ffffff;
  --tint: #d6e9e6;
  --danger: #a63d2f;
  --danger-tint: #f3ddd8;
  --brass: #b8893a;
  --shadow: 0 10px 30px rgba(18, 30, 26, .18);

  --k-folder: #b8893a; --k-image: #4f7f5e; --k-video: #6b5ca5; --k-audio: #b0587a; --k-pdf: #b5483e;
  --k-doc: #3b6ea8; --k-sheet: #3d8b59; --k-slide: #c36d2d; --k-text: #6c7a74; --k-archive: #7a7468;
  --k-cad: #2f7f8a; --k-file: #8a928d;

  --side-w: 256px;
  --font: "Plex AR", system-ui, "Segoe UI", "SF Arabic", Tahoma, sans-serif;
}
:root[data-font="tajawal"] { --font: "Tajawal AR", system-ui, "Segoe UI", "SF Arabic", Tahoma, sans-serif; }
:root[data-font="cairo"] { --font: "Cairo AR", system-ui, "Segoe UI", "SF Arabic", Tahoma, sans-serif; }
:root[data-font="tajawal"] body { font-size: 16px; }
:root[data-font="cairo"] body { line-height: 1.7; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stone: #0e1210; --board: #171c1a; --board-2: #1f2623; --ink: #e9efeb; --ink-2: #aab7b0; --ink-3: #85948d;
    --line: #2a332f; --line-2: #38433e; --petrol: #3bb0a7; --petrol-2: #55c2b9; --on-petrol: #06201e; --tint: #17332f;
    --danger: #e0806f; --danger-tint: #3a211d; --brass: #d1a24f; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    --k-folder: #d1a24f; --k-image: #71a782; --k-video: #9183cc; --k-audio: #d27c9b; --k-pdf: #d8695d;
    --k-doc: #6c9bd2; --k-sheet: #62b07f; --k-slide: #e1914f; --k-text: #93a39c; --k-archive: #a39d90; --k-cad: #55a7b2; --k-file: #a2aba6;
  }
}
:root[data-theme="dark"] {
  --stone: #0e1210; --board: #171c1a; --board-2: #1f2623; --ink: #e9efeb; --ink-2: #aab7b0; --ink-3: #85948d;
  --line: #2a332f; --line-2: #38433e; --petrol: #3bb0a7; --petrol-2: #55c2b9; --on-petrol: #06201e; --tint: #17332f;
  --danger: #e0806f; --danger-tint: #3a211d; --brass: #d1a24f; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --k-folder: #d1a24f; --k-image: #71a782; --k-video: #9183cc; --k-audio: #d27c9b; --k-pdf: #d8695d;
  --k-doc: #6c9bd2; --k-sheet: #62b07f; --k-slide: #e1914f; --k-text: #93a39c; --k-archive: #a39d90; --k-cad: #55a7b2; --k-file: #a2aba6;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--stone); color: var(--ink); font: 15px/1.6 var(--font);
  min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; border-radius: 4px; }
.num { unicode-bidi: isolate; direction: ltr; display: inline-block; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 28px; height: 28px; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

/* ───── أزرار وحقول ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--board); font-weight: 600; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--board-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--petrol); border-color: var(--petrol); color: var(--on-petrol); }
.btn-primary:hover { background: var(--petrol-2); border-color: var(--petrol-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--danger); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--board-2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: var(--ink-2);
}
.iconbtn:hover { background: var(--board-2); color: var(--ink); }
.iconbtn.on { background: var(--tint); color: var(--petrol); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: 14px; }
.input {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--board); outline: none;
}
.input:focus { border-color: var(--petrol); box-shadow: 0 0 0 3px var(--tint); }
.hint { color: var(--ink-3); font-size: 13px; }
.err { color: var(--danger); font-size: 14px; min-height: 22px; margin: 0 0 8px; }

/* ───── شاشة الدخول ───── */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.1fr); }
.login-art {
  background: var(--petrol); color: var(--on-petrol); padding: 48px; display: flex; flex-direction: column;
  gap: min(9vh, 72px); position: relative; overflow: hidden;
}
.login-art .fronts {
  position: absolute; inset: auto 0 0 0; height: 40%; display: grid; grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr); gap: 12px; padding: 0 28px 28px; opacity: .9;
}
.fronts i { position: relative; border-radius: 5px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), inset 0 0 0 7px rgba(255,255,255,.04), inset 0 0 0 8px rgba(255,255,255,.14); }
.fronts i::before { content: ""; position: absolute; top: 16px; left: calc(50% - 26px); width: 52px; height: 6px; border-radius: 3px; background: #e5c27a; }
.fronts i:nth-child(n+4)::before { top: auto; bottom: 16px; }
.login-art .brand { position: relative; padding: 0; }
.login-art .mark { background: rgba(255,255,255,.16); }
.login-art h1 { margin: 0; font-size: 34px; line-height: 1.3; max-width: 11em; position: relative; }
.login-art p { margin: 10px 0 0; max-width: 24em; opacity: .85; position: relative; }
.login-form { display: grid; place-items: center; padding: 32px 24px; }
.login-form form { width: min(380px, 100%); }
.login-form h2 { margin: 0 0 4px; font-size: 24px; }
.login-form .sub { margin: 0 0 24px; color: var(--ink-2); }
.login-form .btn { width: 100%; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); margin: 18px 0; font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.flow-wait { padding: 14px; border-radius: 8px; background: var(--tint); margin-top: 14px; font-size: 14px; display: grid; gap: 8px; }
.flow-wait a { color: var(--petrol); font-weight: 700; }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-art { padding: 28px 24px 150px; min-height: 0; }
  .login-art h1 { font-size: 26px; }
  .login-art .fronts { height: 120px; padding: 0 16px 16px; grid-template-rows: 1fr; grid-template-columns: repeat(4, 1fr); }
  .fronts i:nth-child(n+5) { display: none; }
  .fronts i:nth-child(n+4)::before { top: 12px; bottom: auto; }
}

/* ───── الهيكل ───── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px;
  background: var(--board); border-inline-end: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 800; font-size: 18px; }
.mark { width: 34px; height: 34px; border-radius: 7px; background: var(--petrol); display: grid; place-items: center; position: relative; }
.mark::before { content: ""; width: 18px; height: 11px; border-radius: 2px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); }
.mark::after { content: ""; position: absolute; top: 12px; width: 8px; height: 2.5px; border-radius: 2px; background: #e5c27a; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.nav-item:hover { background: var(--board-2); color: var(--ink); }
.nav-item.on { background: var(--tint); color: var(--petrol); }
.side .grow { flex: 1; }
.quota { padding: 0 8px; display: grid; gap: 8px; font-size: 13px; color: var(--ink-2); }
.meter { position: relative; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); background: var(--board-2); overflow: hidden; }
.meter::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to left, transparent 0 calc(10% - 1px), var(--line-2) calc(10% - 1px) 10%); opacity: .8; }
.meter > i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--petrol); }
.meter.warn > i { background: var(--brass); }
.meter.full > i { background: var(--danger); }
.who { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.who .me { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 700; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--board); display: grid; place-items: center; font-size: 14px; font-weight: 800; flex: none; }
.who .nav-item { min-height: 38px; font-weight: 500; font-size: 14px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  background: color-mix(in srgb, var(--stone) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  min-height: 64px;
}
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { padding: 6px 8px; border-radius: 6px; color: var(--ink-2); font-weight: 600; }
.crumb:hover { background: var(--board-2); color: var(--ink); }
.crumb:last-child { color: var(--ink); font-size: 18px; font-weight: 800; }
.crumbs .sep { color: var(--ink-3); }
.view-title { font-size: 20px; font-weight: 800; padding: 0 8px; }
.search { position: relative; width: min(320px, 34vw); }
.search .ic { position: absolute; inset-inline-start: 12px; top: 12px; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; min-height: 44px; padding: 0 38px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--board); outline: none; }
.search input:focus { border-color: var(--petrol); box-shadow: 0 0 0 3px var(--tint); }
.search .clear { position: absolute; inset-inline-end: 4px; top: 2px; }
.top-actions { display: flex; align-items: center; gap: 4px; }

.selbar {
  position: sticky; top: 64px; z-index: 6; display: flex; align-items: center; gap: 4px; padding: 8px 24px;
  background: var(--petrol); color: var(--on-petrol); flex-wrap: wrap;
}
.selbar .count { font-weight: 800; margin-inline-end: 8px; }
.selbar .btn-quiet { color: var(--on-petrol); min-height: 38px; padding: 0 10px; }
.selbar .btn-quiet:hover { background: rgba(255,255,255,.16); }
.selbar .spacer { flex: 1; }

.content { padding: 20px 24px 120px; flex: 1; }
.section-note { color: var(--ink-3); font-size: 13px; margin: 0 0 12px; }

/* ───── المجلدات (واجهات أدراج) والملفات (عينات ألواح) ───── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.grid + .grid, .grid-title + .grid { margin-top: 0; }
.grid-title { margin: 22px 0 10px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.grid-title:first-child { margin-top: 0; }
.tile { position: relative; min-width: 0; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tile .chk {
  position: absolute; z-index: 2; top: 10px; inset-inline-start: 14px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line-2); background: var(--board); display: grid; place-items: center; color: transparent;
  opacity: 0; transition: opacity .12s;
}
.tile .chk .ic { width: 14px; height: 14px; stroke-width: 3; }
.tile:hover .chk, .tile:focus-within .chk, .selecting .tile .chk { opacity: 1; }
.tile.sel .chk { background: var(--petrol); border-color: var(--petrol); color: var(--on-petrol); opacity: 1; }
.tile .tmore { position: absolute; z-index: 2; top: 6px; inset-inline-end: 6px; opacity: 0; transition: opacity .12s; background: var(--board); border: 1px solid var(--line); width: 34px; height: 34px; }
.tile:hover .tmore, .tile:focus-within .tmore, .tile .tmore[aria-expanded="true"] { opacity: 1; }
.tile .name { font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .meta { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.tile .meta .ic { width: 13px; height: 13px; }
.star-on { color: var(--brass); }
.star-on .ic { fill: var(--brass); }

.tile.folder {
  min-height: 112px; padding: 30px 16px 12px; background: var(--board); border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: inset 0 0 0 6px var(--board), inset 0 0 0 7px var(--line);
}
.tile.folder::before {
  content: ""; position: absolute; top: 14px; left: calc(50% - 22px); width: 44px; height: 5px; border-radius: 3px; background: var(--k-folder);
}
.tile.folder:hover { border-color: var(--ink-3); }
.tile.folder .tmore { top: 4px; }
.tile.folder .chk { top: 8px; }

.tile.file { background: var(--board); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.tile.file::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--kc, var(--k-file)); }
.tile.file:hover { border-color: var(--line-2); }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--board-2); display: grid; place-items: center; overflow: hidden; color: var(--kc, var(--k-file)); gap: 4px; align-content: center; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .thumb .klabel { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.tile .tbody { padding: 10px 12px 11px 12px; padding-inline-start: 16px; }
.tile.sel { outline: 2px solid var(--petrol); outline-offset: 1px; }
.tile.sel.folder, .tile.sel.file .tbody { background: var(--tint); }
.tile.sel.folder { box-shadow: inset 0 0 0 6px var(--tint), inset 0 0 0 7px var(--line); background: var(--tint); }

/* قائمة */
.list { background: var(--board); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 150px 90px 44px; align-items: center; gap: 8px; min-height: 52px; padding: 4px 12px; border-top: 1px solid var(--line); cursor: pointer; position: relative; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--board-2); }
.row.sel { background: var(--tint); }
.row .r-ic { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; color: var(--kc, var(--k-file)); background: var(--board-2); position: relative; overflow: hidden; }
.row .r-ic img { width: 100%; height: 100%; object-fit: cover; }
.row .r-ic.fold { color: var(--k-folder); }
.row .r-name { min-width: 0; overflow: hidden; }
.row .r-name .nm { display: flex; align-items: center; gap: 6px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r-name .sd { display: none; }
.row .r-act { display: flex; justify-content: flex-end; }
.row.trash { grid-template-columns: 26px 40px minmax(0, 1fr) 150px 90px 92px; cursor: pointer; }
.tchk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; transition: background .12s, border-color .12s; }
.tchk .ic { width: 13px; height: 13px; stroke-width: 3; }
.row.trash.sel .tchk, .tchk.on { background: var(--petrol); border-color: var(--petrol); color: var(--on-petrol); }
.row.trash:focus-visible { outline: 2px solid var(--petrol); outline-offset: -2px; }
.trash-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; min-height: 44px; }
.trash-bar .count { font-weight: 800; }
.trash-bar .spacer { flex: 1; }
.tall { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px 0 6px; background: none; border: 0; border-radius: 8px; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.tall:hover { background: var(--board-2); }
.tall:disabled, .trash-bar .btn:disabled { opacity: .6; pointer-events: none; }
.row:not(.trash):hover .chk { display: grid; }
.row:not(.trash):hover .r-ic { display: none; }
.row .r-date, .row .r-size { color: var(--ink-3); font-size: 13.5px; }
.row .chk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: none; place-items: center; color: transparent; }
.selecting .row .chk { display: grid; }
.selecting .row .r-ic { display: none; }
.row.sel .chk { background: var(--petrol); border-color: var(--petrol); color: var(--on-petrol); }
.row .chk .ic { width: 13px; height: 13px; stroke-width: 3; }
.list-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) 150px 90px 44px; gap: 8px; padding: 8px 12px; background: var(--board-2); font-size: 13px; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.list-head button { text-align: start; font-weight: 700; color: inherit; }
.list-head button:hover { color: var(--ink); }

/* حالات */
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 72px 20px; color: var(--ink-2); }
.empty .big { width: 84px; height: 56px; border-radius: 6px; position: relative; border: 1px solid var(--line-2); box-shadow: inset 0 0 0 5px var(--stone), inset 0 0 0 6px var(--line-2); margin-bottom: 8px; }
.empty .big::before { content: ""; position: absolute; top: 11px; left: calc(50% - 15px); width: 30px; height: 4px; border-radius: 2px; background: var(--k-folder); }
.empty h3 { margin: 0; font-size: 18px; color: var(--ink); }
.empty p { margin: 0; max-width: 28em; }
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--danger-tint); color: var(--danger); font-weight: 600; margin-bottom: 14px; }
.banner .btn { margin-inline-start: auto; }
.skel { height: 112px; border-radius: 8px; background: var(--board-2); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ───── قوائم منبثقة ───── */
#menu { position: fixed; inset: 0; z-index: 60; }
#menu .scrim { position: absolute; inset: 0; }
#menu .pop {
  position: fixed; min-width: 210px; max-width: 300px; background: var(--board); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; max-height: 80dvh; overflow-y: auto;
}
#menu .mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 6px; text-align: start; font-weight: 500; }
#menu .mi:hover, #menu .mi:focus-visible { background: var(--board-2); }
#menu .mi.danger { color: var(--danger); }
#menu .mi.on { color: var(--petrol); font-weight: 700; }
#menu .mi .ic { color: var(--ink-3); }
#menu .mi.danger .ic { color: var(--danger); }
#menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
#menu .pop-title { padding: 6px 12px 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

/* ───── نوافذ الحوار ───── */
dialog.dlg {
  width: min(500px, calc(100vw - 24px)); max-height: min(86dvh, 720px); padding: 0; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--board); color: var(--ink); box-shadow: var(--shadow); overflow: hidden;
}
dialog.dlg[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(8, 14, 12, .55); }
.dlg-h { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-b { padding: 18px 20px; overflow-y: auto; flex: 1; }
.dlg-b p { margin: 0 0 8px; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--board-2); }
.dlg-f .spacer { flex: 1; }

.picker-path { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }
.picker-path button { padding: 4px 8px; border-radius: 6px; color: var(--ink-2); font-weight: 600; }
.picker-path button:last-child { color: var(--ink); font-weight: 800; }
.picker-path button:hover { background: var(--board-2); }
.picker-list { border: 1px solid var(--line); border-radius: 8px; max-height: 300px; overflow-y: auto; background: var(--board); }
.picker-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border-top: 1px solid var(--line); text-align: start; }
.picker-item:first-child { border-top: 0; }
.picker-item:hover { background: var(--board-2); }
.picker-item[disabled] { opacity: .4; cursor: default; }
.picker-item .ic { color: var(--k-folder); }
.picker-empty { padding: 24px; text-align: center; color: var(--ink-3); }

.share-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--board-2); }
.linkbox { display: flex; gap: 6px; align-items: center; }
.linkbox input { flex: 1; min-width: 0; min-height: 40px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--board); direction: ltr; text-align: left; font-size: 13.5px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: var(--board); border: 1px solid var(--line); }
.sub-h { font-size: 14px; font-weight: 800; margin: 18px 0 10px; }
.sub-h:first-child { margin-top: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--petrol); }

/* ───── العارض ───── */
dialog.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: #0b0f0e; color: #eef3f0;
}
dialog.viewer[open] { display: flex; flex-direction: column; }
.v-top { display: flex; align-items: center; gap: 4px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: rgba(255,255,255,.04); }
.v-top .title { flex: 1; min-width: 0; padding: 0 8px; }
.v-top .title b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-top .title small { color: #93a39c; }
.v-top .iconbtn, .v-top .btn { color: #dfe8e3; }
.v-top .iconbtn:hover { background: rgba(255,255,255,.12); }
.v-top .btn { border-color: rgba(255,255,255,.25); background: transparent; min-height: 38px; }
.v-top .btn:hover { background: rgba(255,255,255,.12); }
.v-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.v-stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.v-stage.zoom { overflow: auto; place-items: start; }
.v-stage.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.v-stage video { width: 100%; height: 100%; background: #000; }
.v-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.v-stage pre { margin: 0; width: min(900px, 100%); height: 100%; overflow: auto; padding: 20px; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.7 ui-monospace, Menlo, Consolas, "DejaVu Sans Mono", monospace; text-align: start; background: #11171a; color: #dfe8e3; unicode-bidi: plaintext; }
.v-card { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 28px; max-width: 420px; }
.v-card .big-ic { width: 96px; height: 96px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.07); color: var(--kc); }
.v-card .big-ic .ic { width: 48px; height: 48px; }
.v-card h3 { margin: 0; overflow-wrap: anywhere; }
.v-card p { margin: 0; color: #93a39c; }
.v-card .row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.v-card .btn { border-color: rgba(255,255,255,.3); color: #eef3f0; background: transparent; }
.v-card .btn-primary { background: #3bb0a7; border-color: #3bb0a7; color: #06201e; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; border-radius: 8px; z-index: 3; }
.v-nav:hover { background: rgba(0,0,0,.7); }
.v-nav.prev { right: 10px; } .v-nav.next { left: 10px; }
.v-audio { display: grid; gap: 16px; justify-items: center; width: min(420px, 90%); }
.v-audio audio { width: 100%; }
.v-loading { color: #93a39c; }

/* ───── إشعارات ورفع ───── */
#toasts { position: fixed; z-index: 90; inset: auto 0 24px 0; width: auto; height: auto; margin: 0; border: 0; background: transparent; overflow: visible; color: inherit; display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: min(520px, 100%); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--board); box-shadow: var(--shadow); font-weight: 600; animation: toast-in .18s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
.toast button { color: inherit; text-decoration: underline; font-weight: 700; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.uploads { position: fixed; z-index: 40; bottom: 18px; inset-inline-end: 18px; width: min(380px, calc(100vw - 36px)); background: var(--board); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.uploads .u-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 8px; padding-inline-start: 16px; background: var(--board-2); border-bottom: 1px solid var(--line); font-weight: 700; }
.uploads .u-h span { flex: 1; }
.uploads .u-list { max-height: 260px; overflow-y: auto; }
.up-row { display: grid; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13.5px; }
.up-row:first-child { border-top: 0; }
.up-row .t { display: flex; align-items: center; gap: 8px; }
.up-row .t b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up-row .t span { color: var(--ink-3); flex: none; }
.up-row .bar { height: 5px; border-radius: 3px; background: var(--board-2); overflow: hidden; border: 1px solid var(--line); }
.up-row .bar i { display: block; height: 100%; background: var(--petrol); width: 0; transition: width .15s linear; }
.up-row.done .bar i { background: var(--k-sheet); }
.up-row.error .bar i { background: var(--danger); }
.up-row.error .t span { color: var(--danger); }

.dropveil { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--petrol) 82%, transparent); color: var(--on-petrol); text-align: center; pointer-events: none; }
.dropveil div { border: 2px dashed currentColor; border-radius: 16px; padding: 44px 56px; font-size: 22px; font-weight: 800; display: grid; gap: 8px; justify-items: center; }
.dropveil small { font-size: 15px; font-weight: 500; opacity: .9; }

/* ───── جوال ───── */
.tabs, .fab { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .crumbs { flex-basis: 100%; order: 1; }
  .search { order: 2; flex: 1; width: auto; }
  .top-actions { order: 3; }
  .top-actions .desk { display: none; }
  .selbar { top: 0; padding: 8px 10px; position: fixed; inset-inline: 0; z-index: 30; }
  .content { padding: 14px 14px 170px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .tile .tmore { opacity: 1; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 44px; }
  .row.trash { grid-template-columns: 26px 40px minmax(0, 1fr) 92px; }
  .row .r-date, .row .r-size, .list-head { display: none; }
  .row .r-name .sd { display: block; }
  .selbar { flex-wrap: nowrap; gap: 0; padding: 6px 6px; }
  .selbar .lbl { display: none; }
  .selbar .btn-quiet { padding: 0; width: 42px; min-height: 42px; }
  .selbar .iconbtn { width: 42px; height: 42px; }
  .selbar .count { margin-inline-end: 4px; white-space: nowrap; font-size: 14px; }
  #menu .scrim { background: rgba(8, 14, 12, .45); }
  .row:not(.trash):hover .chk { display: none; }
  .row:not(.trash):hover .r-ic { display: grid; }
  .selecting .row:not(.trash) .chk { display: grid !important; }
  .selecting .row:not(.trash) .r-ic { display: none !important; }
  .tabs {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; inset-inline: 0; bottom: 0;
    background: var(--board); border-top: 1px solid var(--line-2); padding-bottom: env(safe-area-inset-bottom);
  }
  .tab { text-decoration: none; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 58px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
  .tab.on { color: var(--petrol); }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 21; inset-inline-end: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 16px; background: var(--petrol); color: var(--on-petrol); box-shadow: var(--shadow);
  }
  .fab .ic { width: 26px; height: 26px; }
  .uploads { bottom: calc(144px + env(safe-area-inset-bottom)); inset-inline-start: 12px; inset-inline-end: auto; }
  #toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
  /* نوافذ تنزلق من الأسفل */
  dialog.dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 88dvh; }
  .dlg-f { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #menu .pop { inset-inline: 0 !important; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; max-width: none; border-radius: 16px 16px 0 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  #menu .mi { min-height: 50px; font-size: 16px; }
  .v-nav { width: 40px; height: 56px; }
}
@media (hover: none) {
  .tile .tmore { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───── للعرض فقط / فحص الفيروسات ───── */
.banner.ro { background: var(--board-2); color: var(--ink-2); border: 1px solid var(--line-2); font-weight: 500; }
.banner.ro .ic { color: var(--petrol); flex: none; }
.ro-flag { display: inline-flex; color: var(--ink-3); }
.ro-flag .ic { width: 14px; height: 14px; }
.up-row.uploading.scanning .bar i, .up-row.uploading.storing .bar i { width: 38% !important; transition: none; animation: ff-indet 1.1s ease-in-out infinite alternate; background: var(--petrol); }
.up-row.uploading.retry .bar i { background: var(--brass); }
.up-row.uploading.retry .t span, .up-row.uploading.scanning .t span, .up-row.uploading.storing .t span { color: var(--petrol); font-weight: 600; }
.up-row.virus { background: var(--danger-tint); }
.up-row.virus .t b { color: var(--danger); }
.up-row.error .t { align-items: flex-start; }
.up-row.error .t span { white-space: normal; }
.u-foot { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); background: var(--board-2); }
.u-foot .ic { color: var(--petrol); }
@keyframes ff-indet { from { transform: translateX(-120%); } to { transform: translateX(160%); } }
[dir="rtl"] .up-row.uploading.scanning .bar i, [dir="rtl"] .up-row.uploading.storing .bar i { animation-name: ff-indet-rtl; }
@keyframes ff-indet-rtl { from { transform: translateX(120%); } to { transform: translateX(-160%); } }
@media (prefers-reduced-motion: reduce) { .up-row.uploading.scanning .bar i, .up-row.uploading.storing .bar i { animation: none; width: 100% !important; opacity: .55; } }

/* ───── ألوان التطبيق (لكل شركة في المجموعة) ───── */
:root[data-accent="burgundy"] { --petrol: #7b2442; --petrol-2: #93305a; --tint: #f1dde4; }
:root[data-accent="green"] { --petrol: #2d6a3e; --petrol-2: #388049; --tint: #dcebdf; }
:root[data-accent="gold"] { --petrol: #8a6516; --petrol-2: #a47a1e; --tint: #f2e8cf; }
:root[data-theme="dark"][data-accent="burgundy"] { --petrol: #d97c9a; --petrol-2: #e594af; --tint: #3a1a26; --on-petrol: #2b0d17; }
:root[data-theme="dark"][data-accent="green"] { --petrol: #6dbb80; --petrol-2: #86cb97; --tint: #1a3322; --on-petrol: #0a2012; }
:root[data-theme="dark"][data-accent="gold"] { --petrol: #d9aa4a; --petrol-2: #e5bd66; --tint: #33290f; --on-petrol: #231a05; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-accent="burgundy"] { --petrol: #d97c9a; --petrol-2: #e594af; --tint: #3a1a26; --on-petrol: #2b0d17; }
  :root:not([data-theme="light"])[data-accent="green"] { --petrol: #6dbb80; --petrol-2: #86cb97; --tint: #1a3322; --on-petrol: #0a2012; }
  :root:not([data-theme="light"])[data-accent="gold"] { --petrol: #d9aa4a; --petrol-2: #e5bd66; --tint: #33290f; --on-petrol: #231a05; }
}
#menu .mi .sw { width: 20px; height: 20px; border-radius: 50%; background: var(--c); border: 2px solid var(--board); box-shadow: 0 0 0 1px var(--line-2); flex: none; }
#menu .mi.on .sw { box-shadow: 0 0 0 2px var(--c); }

/* ───── حركة وتفاعل (تُعطَّل عند تفضيل تقليل الحركة) ───── */
@media (prefers-reduced-motion: no-preference) {
  /* دخول المحتوى عند التنقل بين المجلدات: لحظة واحدة منسّقة */
  .content.enter .tile, .content.enter .row { animation: tile-in .34s cubic-bezier(.2, .75, .25, 1) both; animation-delay: calc(min(var(--i, 0), 12) * 18ms); }
  .content.enter .banner, .content.enter .empty { animation: tile-in .3s ease-out both; }
  @keyframes tile-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }

  .tile.file { transition: transform .16s ease, box-shadow .16s ease, border-color .16s; }
  .tile.file:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(18, 30, 26, .13); }
  .tile.file .thumb img { transition: transform .35s ease; }
  .tile.file:hover .thumb img { transform: scale(1.04); }

  /* المجلد كدرج: عند المرور ينفتح قليلاً ويتسع المقبض */
  .tile.folder { transition: transform .18s cubic-bezier(.2, .8, .3, 1), box-shadow .18s, border-color .15s, background .15s; }
  .tile.folder::before { transition: width .2s ease, left .2s ease, background .15s; }
  .tile.folder:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 6px var(--board), inset 0 0 0 7px var(--line), 0 10px 18px rgba(18, 30, 26, .14); }
  .tile.folder:hover::before { width: 72px; left: calc(50% - 36px); }

  .tile .chk { transition: opacity .12s, transform .15s; }
  .tile.sel .chk { animation: chk-pop .24s cubic-bezier(.3, 1.6, .5, 1); }
  @keyframes chk-pop { from { transform: scale(.5); } }

  dialog[open] { animation: dlg-in .2s cubic-bezier(.2, .8, .3, 1); }
  dialog[open]::backdrop { animation: fade-in .2s ease-out; }
  dialog.viewer[open] { animation: fade-in .18s ease-out; }
  @keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
  @keyframes fade-in { from { opacity: 0; } }

  #menu .pop { animation: pop-in .14s ease-out; transform-origin: top; }
  @keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
  .uploads:not([hidden]) { animation: up-in .26s cubic-bezier(.2, .8, .3, 1); }
  @keyframes up-in { from { opacity: 0; transform: translateY(18px); } }
  .skel { background: linear-gradient(100deg, var(--board-2) 30%, var(--board) 50%, var(--board-2) 70%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
  @keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  #menu .pop { animation: sheet-in .22s cubic-bezier(.2, .8, .3, 1); transform-origin: bottom; }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } }
}

/* ───── سحب العناصر إلى مجلد ───── */
body.dnd .tile.dragging, body.dnd .row.dragging { opacity: .45; }
.tile.folder.drop { border-color: var(--petrol); background: var(--tint); transform: translateY(4px) scale(.98); box-shadow: inset 0 0 0 6px var(--tint), inset 0 0 0 7px var(--petrol); }
.tile.folder.drop::before { background: var(--petrol); width: 80px; left: calc(50% - 40px); }
.row.drop, .crumb.drop { background: var(--tint); outline: 2px dashed var(--petrol); outline-offset: -2px; border-radius: 8px; }

/* ───── عارض الصور: تكبير وتحريك ───── */
.v-stage.img { touch-action: none; }
.v-stage.img img { cursor: zoom-in; user-select: none; -webkit-user-drag: none; will-change: transform; transform-origin: center; }
.v-stage.zoomed img { cursor: grab; }
.v-stage.zoomed:active img { cursor: grabbing; }
.v-zoom { position: absolute; z-index: 4; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(20, 26, 24, .78); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .12); }
.v-zoom button { min-width: 40px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: #eef3f0; font-weight: 700; font-size: 13px; }
.v-zoom button:hover { background: rgba(255, 255, 255, .14); }
.v-zoom .pct { min-width: 56px; font-variant-numeric: tabular-nums; direction: ltr; }

/* ───── الشركات ───── */
.co-switch { display: flex; align-items: center; gap: 10px; width: 100%; margin: 2px 0 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--board-2); color: var(--ink); font: inherit; cursor: pointer; text-align: start; transition: border-color .15s, background .15s; }
.co-switch:hover { border-color: var(--petrol); }
.co-switch .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--petrol); flex: none; box-shadow: 0 0 0 3px var(--tint); }
.co-switch .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-switch .ic { width: 16px; height: 16px; color: var(--ink-3); transform: rotate(-90deg); }
.co-picks { display: grid; gap: 10px; margin: 6px 0 18px; }
.co-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--board); color: var(--ink); font: inherit; cursor: pointer; text-align: start; transition: border-color .15s, transform .15s, box-shadow .15s; }
.co-pick:hover { border-color: var(--c); transform: translateY(-1px); box-shadow: 0 6px 18px -10px var(--c); }
.co-pick:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.co-pick[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--board)); }
.co-pick .bar { width: 6px; align-self: stretch; border-radius: 3px; background: var(--c); flex: none; }
.co-pick b { display: block; font-size: 15.5px; }
.co-pick small { color: var(--ink-3); font-size: 12.5px; }
.co-pick .in { margin-inline-start: auto; font-size: 12px; color: var(--c); font-weight: 700; }
.co-back { background: none; border: 0; color: var(--petrol); font: inherit; font-weight: 700; padding: 0; cursor: pointer; margin-bottom: 8px; }
.login-form .co-name { display: flex; align-items: center; gap: 8px; font-weight: 800; margin: 0 0 4px; }
.login-form .co-name i { width: 10px; height: 10px; border-radius: 50%; background: var(--petrol); }
#menu .mi .sw + span { flex: 1; }
#menu .mi small { color: var(--ink-3); font-size: 12px; margin-inline-start: auto; }
#menu .mi .fsample { font-size: 15px; }
#menu .mi.f-plex .fsample { font-family: "Plex AR", sans-serif; }
#menu .mi.f-tajawal .fsample { font-family: "Tajawal AR", sans-serif; }
#menu .mi.f-cairo .fsample { font-family: "Cairo AR", sans-serif; }

/* ───── نافذة ضغط الفيديو ───── */
.vq-dlg .vq-list { display: grid; gap: 8px; margin: 14px 0; }
.vq-opt { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.vq-opt:hover { background: var(--board-2); }
.vq-opt:has(input:checked) { border-color: var(--petrol); background: var(--tint); }
.vq-opt input { margin-top: 3px; accent-color: var(--petrol); flex: none; }
.vq-opt span { display: flex; flex-direction: column; gap: 2px; }
.vq-opt small { color: var(--ink-3); font-size: 12.5px; }
.vq-dlg p.sm { color: var(--ink-3); font-size: 13px; margin-top: 10px; }
.up-row.compressing .bar i { background: var(--petrol); opacity: .85; }
