/* ===================== نظام الأرشفة - التنسيقات ===================== */
:root{
  --navy-900:#081a33; --navy-800:#0b2545; --navy-700:#123a63; --navy-600:#1b4f80;
  --gold:#d4a437; --gold-soft:#f3e2b8;
  --bg:#f1f4f8; --surface:#ffffff; --surface-2:#f7f9fc;
  --line:#e2e8f0; --line-strong:#cbd5e1;
  --text:#0f1b2d; --text-2:#475569; --text-3:#8194ac;
  --green:#12805c; --green-bg:#e4f5ee;
  --red:#c0392b; --red-bg:#fdeceb;
  --blue:#1b4f80; --blue-bg:#e8f0f8;
  --amber:#a86b00; --amber-bg:#fdf3e0;
  --r-sm:8px; --r:12px; --r-lg:16px;
  --shadow-sm:0 1px 2px rgba(8,26,51,.06), 0 1px 3px rgba(8,26,51,.05);
  --shadow:0 4px 14px rgba(8,26,51,.08);
  --shadow-lg:0 18px 50px rgba(8,26,51,.18);
  --sidebar-w:264px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:'Cairo','Segoe UI',Tahoma,system-ui,sans-serif;
  font-size:14.5px; line-height:1.65;
  -webkit-font-smoothing:antialiased;
}
/* الأرقام والتواريخ دائما إنكليزي */
.ltr,.num,input[type=date],input[type=number],input[type=password],
.mono,.clock,code{direction:ltr; unicode-bidi:isolate;
  font-family:'IBM Plex Sans','Segoe UI',Arial,sans-serif;
  font-variant-numeric:lining-nums tabular-nums;}
.num{display:inline-block}
h1,h2,h3,h4{margin:0; font-weight:700; letter-spacing:-.01em}
a{color:var(--navy-600); text-decoration:none}
img{max-width:100%}
[hidden]{display:none !important}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#c7d2e0;border-radius:99px;border:3px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:#a9b8ca;background-clip:content-box}

/* ============================ شاشة الدخول ============================ */
.login-screen{position:fixed;inset:0;display:grid;place-items:center;padding:20px;overflow:auto;z-index:50}
.login-bg{position:absolute;inset:0;background:
  radial-gradient(900px 500px at 80% -5%, #1b4f80 0%, transparent 60%),
  radial-gradient(700px 500px at 10% 105%, #123a63 0%, transparent 55%),
  linear-gradient(160deg,#081a33,#0b2545 55%,#102f52)}
.login-bg::after{content:'';position:absolute;inset:0;opacity:.07;
  background-image:linear-gradient(#fff 1px,transparent 1px),linear-gradient(90deg,#fff 1px,transparent 1px);
  background-size:44px 44px}
.login-card{position:relative;width:100%;max-width:400px;background:var(--surface);
  border-radius:20px;padding:36px 32px 28px;box-shadow:var(--shadow-lg);text-align:center}
.login-logo{margin-bottom:14px}
.login-card h1{font-size:22px}
.login-sub{margin:6px 0 24px;color:var(--text-3);font-size:13.5px}
.login-hint{margin-top:16px;font-size:12.5px;color:var(--text-3)}
.btn-block{width:100%;justify-content:center;margin-top:6px}

/* ============================ الحقول ============================ */
.field{display:block;text-align:right;margin-bottom:16px}
.field>span{display:block;font-size:13px;font-weight:600;color:var(--text-2);margin-bottom:6px}
.field .hint{font-weight:400;color:var(--text-3);font-size:12px}
input,select,textarea{
  width:100%;padding:10px 13px;border:1.5px solid var(--line);border-radius:var(--r-sm);
  background:var(--surface);color:var(--text);font-family:inherit;font-size:14.5px;
  transition:border-color .15s, box-shadow .15s; outline:none;
}
textarea{resize:vertical;min-height:80px;line-height:1.6}
input:focus,select:focus,textarea:focus{border-color:var(--navy-600);box-shadow:0 0 0 3px rgba(27,79,128,.13)}
input::placeholder,textarea::placeholder{color:#a9b6c7}
select{cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:left 10px center;background-size:16px;padding-left:34px;appearance:none}
.row{display:flex;gap:14px}
.row>*{flex:1;min-width:0}

/* ============================ الأزرار ============================ */
.btn{display:inline-flex;align-items:center;gap:7px;padding:9px 16px;border-radius:var(--r-sm);
  border:1.5px solid transparent;background:var(--surface);color:var(--text);
  font-family:inherit;font-size:14px;font-weight:600;cursor:pointer;
  transition:all .15s;white-space:nowrap;line-height:1.4}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
.btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.btn-primary{background:var(--navy-800);color:#fff;box-shadow:var(--shadow-sm)}
.btn-primary:hover{background:var(--navy-700)}
.btn-gold{background:var(--gold);color:#3a2a00}
.btn-gold:hover{background:#c39528}
.btn-outline{border-color:var(--line-strong);color:var(--text-2)}
.btn-outline:hover{border-color:var(--navy-600);color:var(--navy-700);background:var(--blue-bg)}
.btn-ghost{background:transparent;color:var(--text-2)}
.btn-ghost:hover{background:rgba(255,255,255,.1)}
.btn-sm{padding:6px 11px;font-size:13px}
.btn-sm svg{width:15px;height:15px}
.btn.danger{color:var(--red)}
.btn-danger{background:var(--red);color:#fff}
.btn-danger:hover{background:#a5312a}
.icon-btn{display:inline-grid;place-items:center;width:34px;height:34px;border:none;background:transparent;
  border-radius:var(--r-sm);cursor:pointer;color:var(--text-2);transition:background .15s,color .15s;padding:0}
.icon-btn:hover{background:var(--surface-2);color:var(--text)}
.icon-btn svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.icon-btn.danger:hover{background:var(--red-bg);color:var(--red)}

/* ============================ الهيكل ============================ */
.app{display:flex;min-height:100vh}
.sidebar{width:var(--sidebar-w);flex:none;background:linear-gradient(180deg,var(--navy-800),var(--navy-900));
  color:#dbe6f2;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;z-index:30}
.brand{display:flex;align-items:center;gap:11px;padding:20px 18px 18px;border-bottom:1px solid rgba(255,255,255,.08)}
.brand>div{min-width:0}
.brand-sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-name{font-size:14.5px;font-weight:700;color:#fff;line-height:1.35;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.brand-sub{font-size:11.5px;color:#7f9bbd;line-height:1.3}
.nav{flex:1;overflow-y:auto;padding:14px 12px;display:flex;flex-direction:column;gap:3px}
.nav-label{font-size:11px;font-weight:700;color:#5f7da3;letter-spacing:.06em;padding:14px 10px 6px}
.nav-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;
  color:#c3d3e6;cursor:pointer;font-size:14px;font-weight:600;border:none;background:transparent;
  width:100%;text-align:right;font-family:inherit;transition:background .15s,color .15s}
.nav-item svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none}
.nav-item:hover{background:rgba(255,255,255,.07);color:#fff}
.nav-item.active{background:var(--gold);color:#3a2a00}
.nav-item .count{margin-inline-start:auto;font-size:11.5px;background:rgba(255,255,255,.14);
  padding:1px 7px;border-radius:99px;font-weight:700}
.nav-item.active .count{background:rgba(0,0,0,.14)}
.sidebar-foot{padding:12px;border-top:1px solid rgba(255,255,255,.08)}
.user-chip{display:flex;align-items:center;gap:10px;padding:8px}
.avatar{width:36px;height:36px;border-radius:50%;background:var(--gold);color:#3a2a00;
  display:grid;place-items:center;font-weight:800;font-size:15px;flex:none}
.user-meta{min-width:0}
.user-name{font-size:13.5px;font-weight:700;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-role{font-size:11.5px;color:#7f9bbd}
.foot-actions{display:flex;gap:6px;margin-top:4px}
.foot-actions .btn{flex:1;justify-content:center;color:#a9c0d8}
.foot-actions .btn.danger{color:#f0a59c}

.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:12px;
  padding:14px 24px;background:rgba(255,255,255,.88);backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line)}
.topbar h2{font-size:18px}
.topbar-right{margin-inline-start:auto;display:flex;align-items:center;gap:10px}
.clock{font-size:13px;color:var(--text-3);font-weight:600}
.content{flex:1;padding:24px;max-width:1500px;width:100%}
.only-mobile{display:none}
.scrim{display:none}

/* ============================ البطاقات ============================ */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-sm)}
.card-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line)}
.card-head h3{font-size:15.5px}
.card-head .spacer{margin-inline-start:auto}
.card-body{padding:20px}
.card-body.tight{padding:0}

.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:16px;margin-bottom:22px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:18px;display:flex;align-items:center;gap:14px;box-shadow:var(--shadow-sm)}
.stat-ico{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;flex:none}
.stat-ico svg{width:22px;height:22px;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.stat-val{font-size:25px;font-weight:800;line-height:1.15;letter-spacing:-.02em}
.stat-lbl{font-size:12.5px;color:var(--text-3);font-weight:600}

.section-title{display:flex;align-items:center;gap:10px;margin:26px 0 14px;font-size:16px;font-weight:700}
.section-title .spacer{margin-inline-start:auto}

/* ============================ الجداول ============================ */
.table-wrap{overflow-x:auto;max-width:100%}
table{width:100%;border-collapse:collapse;font-size:14px}
td.ltr,td.nowrap,td .actions{white-space:nowrap}
th{text-align:right;padding:12px 16px;font-size:12.5px;font-weight:700;color:var(--text-3);
  background:var(--surface-2);border-bottom:1px solid var(--line);white-space:nowrap}
td{padding:12px 16px;border-bottom:1px solid var(--line);vertical-align:middle}
tbody tr:last-child td{border-bottom:none}
tbody tr{transition:background .12s}
tbody tr:hover{background:var(--surface-2)}
td .actions{display:flex;gap:2px;justify-content:flex-end}
.t-name{font-weight:600;display:flex;align-items:center;gap:10px;min-width:160px}
.t-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.t-sub{font-size:12px;color:var(--text-3);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.files-table td{padding:10px 13px}
.files-table th{padding:11px 13px}
.icon-btn.sm{width:30px;height:30px}
.icon-btn.sm svg{width:17px;height:17px}

.ftype{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;flex:none;
  font-size:10.5px;font-weight:800;letter-spacing:.02em;direction:ltr}
.ftype.pdf{background:#fdecea;color:#c0392b}
.ftype.img{background:#eaf4ec;color:#1e7a45}
.ftype.doc{background:#e8f0fa;color:#1b4f80}
.ftype.xls{background:#e6f5ee;color:#0f7a52}
.ftype.zip{background:#fdf3e0;color:#a86b00}
.ftype.other{background:#eef1f5;color:#64748b}

.badge{display:inline-block;padding:2px 9px;border-radius:99px;font-size:11.5px;font-weight:700}
.badge.green{background:var(--green-bg);color:var(--green)}
.badge.red{background:var(--red-bg);color:var(--red)}
.badge.blue{background:var(--blue-bg);color:var(--blue)}
.badge.amber{background:var(--amber-bg);color:var(--amber)}
.badge.gray{background:#eef1f5;color:#64748b}

/* ============================ الأرشيف ============================ */
.archive{display:grid;grid-template-columns:290px minmax(0,1fr);gap:18px;align-items:start}
.archive>*{min-width:0}
.dash-grid{min-width:0}
.dash-grid>*{min-width:0}
.tree-panel{position:sticky;top:88px;max-height:calc(100vh - 110px);display:flex;flex-direction:column}
.tree-scroll{overflow-y:auto;padding:10px}
.company-select{padding:12px 14px;border-bottom:1px solid var(--line)}
.tree-node{border-radius:9px;position:relative}
.tree-row{position:relative;display:flex;align-items:center;gap:7px;padding:7px 9px;border-radius:9px;
  cursor:pointer;font-size:13.8px;font-weight:600;color:var(--text-2);
  transition:background .12s,color .12s;margin-bottom:1px}
.tree-row:hover{background:#eef3f9;color:var(--navy-700)}
.tree-row.active{background:var(--navy-800);color:#fff;box-shadow:0 2px 8px rgba(11,37,69,.22)}
.tree-row.active .tree-ico{opacity:1;color:var(--gold)}
.tree-row.active .tree-count{background:rgba(255,255,255,.2);color:#fff}
.tree-row.active .tree-sub{background:rgba(255,255,255,.14);color:#f3e2b8}
.tree-caret{width:18px;height:18px;display:grid;place-items:center;flex:none;transition:transform .16s;
  opacity:.55;border-radius:5px}
.tree-caret:hover{opacity:1;background:rgba(0,0,0,.07)}
.tree-row.active .tree-caret:hover{background:rgba(255,255,255,.16)}
.tree-caret svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.tree-caret.open{transform:rotate(-90deg)}
.tree-caret.no-kids{visibility:hidden}
.tree-ico{width:17px;height:17px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;opacity:.75}
.tree-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
.tree-sub{font-size:10.5px;background:#e7edf5;color:var(--navy-600);padding:0 5px;border-radius:99px;
  font-weight:800;direction:ltr;flex:none}
.tree-count{font-size:11px;background:#eef1f5;color:var(--text-3);flex:none;
  padding:0 6px;border-radius:99px;font-weight:700;direction:ltr}

/* تداخل الفولدرات الفرعية — خط إرشادي واضح */
.tree-children{position:relative;margin-inline-start:17px;padding-inline-start:13px;
  border-inline-start:2px solid #dde5ef;margin-top:1px}
.tree-children>.tree-node>.tree-row::before{
  content:'';position:absolute;inset-inline-start:-13px;top:50%;width:11px;height:2px;
  background:#dde5ef;border-radius:2px}
.tree-children>.tree-node:last-child::after{
  content:'';position:absolute;inset-inline-start:-15px;top:calc(50% - 1px);bottom:-2px;width:2px;background:var(--surface)}
.tree-empty{padding:26px 12px;text-align:center;color:var(--text-3);font-size:13px}
.tree-empty svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:1.5;opacity:.45;margin-bottom:8px}

/* رأس اللوحة: المسار + الصلاحيات */
.panel-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:13px 18px;
  border-bottom:1px solid var(--line);background:linear-gradient(180deg,#fbfcfe,var(--surface))}
.crumbs{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:13.5px;color:var(--text-3);min-width:0}
.crumbs b{color:var(--text);font-weight:800;font-size:15px}
.crumb-co{font-weight:700;color:var(--navy-600);background:var(--blue-bg);padding:2px 9px;border-radius:99px;font-size:12.5px}
.crumb-sep{display:inline-grid;place-items:center;opacity:.4}
.crumb-sep svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.crumb-link{cursor:pointer;color:var(--navy-600);font-weight:600}
.crumb-link:hover{text-decoration:underline}
.crumb-co,.crumb-co-active{display:inline-flex;align-items:center;gap:5px}
.crumb-co svg,.crumb-co-active svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9;flex:none}
.crumb-co-active{font-weight:800;color:var(--text);font-size:15px}
.up-btn{flex:none;border:1.5px solid var(--line);background:var(--surface)}
.up-btn:not(:disabled):hover{border-color:var(--navy-600);color:var(--navy-700);background:var(--blue-bg)}
.up-btn:disabled{opacity:.35;cursor:not-allowed}
.head-actions{margin-inline-start:auto;display:flex;align-items:center;gap:4px}

/* ====== الفولدرات كبطاقات (تنقّل مثل مستكشف الملفات) ====== */
.folders-block{padding:16px 18px 6px;border-bottom:1px solid var(--line)}
.block-title{display:flex;align-items:center;gap:7px;font-size:12px;font-weight:800;color:var(--text-3);
  letter-spacing:.04em;margin-bottom:11px}
.block-title svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.block-title .num{background:#eef1f5;color:var(--text-3);padding:0 7px;border-radius:99px;font-size:11px}
.folders-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(212px,1fr));gap:10px;padding-bottom:12px}
.folder-tile{display:flex;align-items:center;gap:11px;padding:12px 13px;border:1.5px solid var(--line);
  border-radius:var(--r);background:var(--surface);cursor:pointer;text-align:right;font-family:inherit;
  transition:border-color .15s,box-shadow .15s,transform .12s,background .15s;min-width:0;width:100%}
.folder-tile:hover{border-color:var(--gold);background:#fffdf7;transform:translateY(-2px);
  box-shadow:0 6px 18px -8px rgba(212,164,55,.55)}
.folder-tile:active{transform:translateY(0)}
.ft-ico{width:42px;height:42px;border-radius:11px;display:grid;place-items:center;flex:none;
  background:linear-gradient(145deg,#fdf0d2,#f6e0ae);color:#a8781a;transition:all .15s}
.folder-tile:hover .ft-ico{background:linear-gradient(145deg,var(--gold),#c08f1f);color:#fff}
.ft-ico svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.ft-body{min-width:0;flex:1;display:flex;flex-direction:column;gap:2px}
.ft-name{font-size:14px;font-weight:700;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ft-meta{font-size:11.5px;font-weight:600;color:var(--text-3);display:flex;align-items:center;gap:5px}
.ft-dot{width:3px;height:3px;border-radius:50%;background:var(--line-strong);display:inline-block}
.ft-go{flex:none;opacity:.3;transition:opacity .15s,transform .15s}
.ft-go svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.folder-tile:hover .ft-go{opacity:.9;transform:translateX(-3px);color:var(--amber)}
/* شريط الإجراءات الجماعية */
.bulk-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:11px 18px;
  background:linear-gradient(180deg,#eef4fb,#e6eefa);border-bottom:1px solid #cfdcee;
  position:sticky;top:63px;z-index:6;animation:fade .15s}
.bulk-count{font-size:13px;font-weight:700;color:var(--navy-700);margin-inline-end:4px}
.bulk-count b{font-size:15px}
.bulk-bar .btn{background:var(--surface)}
.files-table tr.picked{background:#eef4fb !important}
.files-table tr.picked td:first-child{box-shadow:inset -3px 0 0 var(--navy-600) !important}
.files-table td .chk,.files-table th .chk{vertical-align:middle}

/* ===== لوحة حالة التخزين ===== */
.disk-head{display:flex;justify-content:space-between;align-items:baseline;gap:10px;flex-wrap:wrap;
  font-size:13px;font-weight:700;color:var(--text-2);margin-bottom:8px}
.disk-head b{font-size:15px;color:var(--text)}
.disk-bar{height:14px;background:#e9eef5;border-radius:99px;overflow:hidden;position:relative}
.disk-fill{height:100%;border-radius:99px;transition:width .4s}
.disk-fill.green{background:linear-gradient(90deg,#16a06f,#0f7a52)}
.disk-fill.amber{background:linear-gradient(90deg,#e0a52c,#a86b00)}
.disk-fill.red{background:linear-gradient(90deg,#e05543,#c0392b)}
.disk-pct{text-align:left;font-size:12px;font-weight:800;margin-top:5px}
.disk-pct.green{color:var(--green)} .disk-pct.amber{color:var(--amber)} .disk-pct.red{color:var(--red)}

.sto-title{margin-top:22px;font-size:12.5px;font-weight:800;color:var(--text-3);letter-spacing:.02em}
.sto-stack{display:flex;height:11px;border-radius:99px;overflow:hidden;background:#e9eef5;margin:9px 0 14px;gap:2px}
.sto-stack span{display:block;transition:width .4s}
.sto-rows{display:grid;gap:2px}
.sto-row{display:flex;align-items:center;gap:9px;padding:8px 10px;border-radius:9px;font-size:13.5px}
.sto-row:hover{background:var(--surface-2)}
.sto-dot{width:10px;height:10px;border-radius:3px;flex:none}
.sto-label{font-weight:700;color:var(--text-2)}
.sto-meta{font-size:12px;color:var(--text-3);font-weight:600}
.sto-size{margin-inline-start:auto;font-weight:800;color:var(--text)}

/* قسم النسخ الاحتياطي */
.bk-block{margin-top:4px}
.bk-row{display:flex;gap:11px;align-items:flex-start;padding:12px 14px;border-radius:var(--r);
  border:1.5px solid var(--line);margin-bottom:9px;background:var(--surface)}
.bk-row.ok{border-color:#bfe3d3;background:#f4fbf8}
.bk-row.warn{border-color:#f0dcb0;background:#fffbf2}
.bk-row.bad{border-color:#f3c9c4;background:#fdf6f5}
.bk-ico{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;flex:none;margin-top:1px}
.bk-row.ok .bk-ico{background:var(--green);color:#fff}
.bk-row.warn .bk-ico{background:var(--amber);color:#fff}
.bk-row.bad .bk-ico{background:var(--red);color:#fff}
.bk-ico svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.bk-body{min-width:0;flex:1}
.bk-name{font-size:13.8px;font-weight:700;color:var(--text);margin-bottom:3px}
.bk-meta{font-size:12.8px;color:var(--text-2);font-weight:600;line-height:1.7}
.bk-path{font-size:11.5px;color:var(--text-3);margin-top:4px;font-weight:600;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bk-path.ltr{direction:ltr;unicode-bidi:isolate;text-align:left}

.sto-foot{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;
  margin-top:18px;padding-top:16px;border-top:1px solid var(--line)}
.sto-foot>div{display:flex;flex-direction:column;gap:3px;min-width:0}
.sto-foot span{font-size:11.5px;font-weight:700;color:var(--text-3)}
.sto-foot b{font-size:13px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sto-action{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px;padding:11px 14px;
  background:var(--amber-bg);border-radius:var(--r);font-size:13px;font-weight:600;color:var(--amber)}
.sto-action button{margin-inline-start:auto}

/* سلة المحذوفات */
.path-text{font-size:12.5px;color:var(--text-2);font-weight:600}
td .path-text{direction:rtl}
.sto-foot .path-text{direction:ltr;unicode-bidi:isolate;text-align:left}
.who{display:inline-flex;align-items:center;gap:6px;font-weight:700;color:var(--text)}
.who::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--red);flex:none}
.ok-btn{color:var(--green);border-color:#bfe3d3}
.ok-btn:hover{background:var(--green-bg);border-color:var(--green);color:var(--green)}
.card-head>svg{width:19px;height:19px;fill:none;stroke:var(--text-3);stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none}
.alert svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;vertical-align:-2px;margin-inline-end:4px}
.nav-item .count{background:var(--red);color:#fff}
.nav-item.active .count{background:rgba(0,0,0,.2);color:#fff}

.hint-line{padding:22px 18px;text-align:center;color:var(--text-3);font-size:13px;
  display:flex;align-items:center;justify-content:center;gap:8px}
.hint-line svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;opacity:.6}
.perm-pill{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:700;color:var(--text-3);
  background:var(--surface-2);border:1px solid var(--line);padding:4px 10px;border-radius:99px;
  max-width:280px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.perm-pill svg{width:13px;height:13px;flex:none;fill:none;stroke:currentColor;stroke-width:2;opacity:.7}

.toolbar{display:flex;align-items:center;gap:9px;flex-wrap:wrap;padding:13px 18px;border-bottom:1px solid var(--line)}
.tb-sep{width:1px;height:24px;background:var(--line);flex:none}
.search-box{position:relative;flex:1;min-width:190px}
.search-box input{padding-right:38px}
.search-box svg{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:17px;height:17px;
  fill:none;stroke:var(--text-3);stroke-width:2;pointer-events:none}
.btn.on{border-color:var(--navy-600);color:var(--navy-700);background:var(--blue-bg)}
.btn .dot{width:7px;height:7px;border-radius:50%;background:var(--gold);display:inline-block}

/* شريط الفلترة */
.filters{padding:14px 18px;background:var(--surface-2);border-bottom:1px solid var(--line);
  display:flex;flex-direction:column;gap:11px}
.filter-line{display:flex;align-items:flex-end;gap:11px;flex-wrap:wrap}
.filter-line.chips{align-items:center;gap:7px}
.fl-field{display:flex;flex-direction:column;gap:4px;margin:0}
.fl-field>span{font-size:11.5px;font-weight:700;color:var(--text-3)}
.fl-field input{width:auto;min-width:148px;padding:7px 11px;font-size:13.5px;background:var(--surface)}
.fl-check{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--text-2);
  cursor:pointer;padding-bottom:7px;white-space:nowrap}
.clear-btn{margin-inline-start:auto;color:var(--red);padding-bottom:7px}
.clear-btn:hover{background:var(--red-bg)}
.seg{display:inline-flex;background:var(--surface);border:1.5px solid var(--line);border-radius:9px;padding:2px;gap:2px}
.seg button{border:none;background:transparent;font-family:inherit;font-size:12.8px;font-weight:700;
  color:var(--text-3);padding:6px 13px;border-radius:7px;cursor:pointer;transition:all .14s;white-space:nowrap}
.seg button:hover{color:var(--text)}
.seg button.on{background:var(--navy-800);color:#fff}
.chips-label{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:700;color:var(--text-3);margin-inline-end:3px}
.chips-label svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9}
.chip{border:1.5px solid var(--line);background:var(--surface);color:var(--text-2);font-family:inherit;
  font-size:12.5px;font-weight:600;padding:5px 12px;border-radius:99px;cursor:pointer;transition:all .14s;white-space:nowrap}
.chip:hover{border-color:var(--navy-600);color:var(--navy-700);background:var(--blue-bg)}
.chip.on{background:var(--gold);border-color:var(--gold);color:#3a2a00}

/* سطر النتائج */
.result-bar{display:flex;align-items:center;gap:9px;flex-wrap:wrap;padding:10px 18px;
  font-size:12.8px;font-weight:600;color:var(--text-3);border-bottom:1px solid var(--line);background:#fbfcfe}
.result-bar b{color:var(--text);font-size:14px}
.rb-dot{width:4px;height:4px;border-radius:50%;background:var(--line-strong);flex:none}

.dropzone{border:2px dashed var(--line-strong);border-radius:var(--r);padding:30px;text-align:center;
  color:var(--text-3);margin:18px;transition:all .15s;cursor:pointer}
.dropzone.slim{padding:15px;margin:14px 18px 18px}
.dropzone:hover,.dropzone.over{border-color:var(--gold);background:#fffaf0;color:var(--amber)}
.dropzone svg{width:34px;height:34px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;margin-bottom:8px}
.dropzone.slim svg{width:22px;height:22px;margin-bottom:4px}

.empty{text-align:center;padding:52px 20px;color:var(--text-3)}
.empty svg{width:46px;height:46px;fill:none;stroke:currentColor;stroke-width:1.4;opacity:.45;margin-bottom:12px}
.empty h4{font-size:15px;color:var(--text-2);margin-bottom:5px}
.empty p{font-size:13px;margin:0 0 14px}

/* ============================ الصلاحيات ============================ */
.perm-grid{border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.perm-head,.perm-row{display:grid;grid-template-columns:1fr repeat(5,72px);align-items:center;gap:0}
.perm-head{background:var(--surface-2);border-bottom:1px solid var(--line);font-size:12px;
  font-weight:700;color:var(--text-3)}
.perm-head>div{padding:9px 8px;text-align:center}
.perm-head>div:first-child{text-align:right;padding-inline-start:14px}
.perm-row{border-bottom:1px solid var(--line);font-size:13.5px}
.perm-row:last-child{border-bottom:none}
.perm-row:hover{background:var(--surface-2)}
.perm-row.company-row{background:#f4f7fb;font-weight:700}
.perm-name{padding:9px 14px;display:flex;align-items:center;gap:8px;min-width:0}
.perm-name span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.perm-cell{display:grid;place-items:center;padding:8px 0}
.chk{appearance:none;width:19px;height:19px;border:1.8px solid var(--line-strong);border-radius:5px;
  cursor:pointer;position:relative;transition:all .13s;background:#fff;padding:0}
.chk:hover{border-color:var(--navy-600)}
.chk:checked{background:var(--navy-800);border-color:var(--navy-800)}
.chk:checked::after{content:'';position:absolute;inset:0;background:no-repeat center/12px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E")}
.perm-indent{display:inline-block;flex:none}

/* ============================ النافذة المنبثقة ============================ */
.modal-root{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:20px}
.modal-backdrop{position:absolute;inset:0;background:rgba(8,26,51,.55);backdrop-filter:blur(3px);animation:fade .18s}
.modal{position:relative;background:var(--surface);border-radius:var(--r-lg);width:100%;max-width:560px;
  max-height:88vh;display:flex;flex-direction:column;box-shadow:var(--shadow-lg);animation:pop .2s}
.modal.wide{max-width:900px}
.modal-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line)}
.modal-head h3{font-size:16.5px;flex:1}
.modal-body{padding:20px;overflow-y:auto;flex:1}
.modal-foot{display:flex;gap:10px;justify-content:flex-start;padding:14px 20px;border-top:1px solid var(--line);background:var(--surface-2);border-radius:0 0 var(--r-lg) var(--r-lg)}
@keyframes fade{from{opacity:0}}
@keyframes pop{from{opacity:0;transform:translateY(14px) scale(.98)}}

.alert{padding:11px 14px;border-radius:var(--r-sm);font-size:13.5px;font-weight:600;margin-bottom:14px}
.alert.error{background:var(--red-bg);color:var(--red)}
.alert.info{background:var(--blue-bg);color:var(--blue)}
.alert.warn{background:var(--amber-bg);color:var(--amber)}
.alert.ok{background:var(--green-bg);color:var(--green)}

/* ============================ التنبيهات ============================ */
.toasts{position:fixed;bottom:22px;left:22px;z-index:200;display:flex;flex-direction:column;gap:9px}
.toast{background:var(--navy-900);color:#fff;padding:12px 17px;border-radius:var(--r);
  box-shadow:var(--shadow-lg);font-size:13.8px;font-weight:600;animation:slideIn .22s;
  display:flex;align-items:center;gap:9px;max-width:380px}
.toast.ok{background:#0f6b4f}
.toast.err{background:#a5312a}
.toast svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2.4;flex:none}
@keyframes slideIn{from{opacity:0;transform:translateX(-26px)}}

.progress{height:5px;background:var(--line);border-radius:99px;overflow:hidden;margin-top:9px}
.progress > div{height:100%;background:var(--gold);width:0;transition:width .2s}

.file-list-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid var(--line);
  border-radius:var(--r-sm);margin-bottom:8px;font-size:13.5px}
.file-list-item .nm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}

.tabs{display:flex;gap:6px;border-bottom:1px solid var(--line);margin-bottom:18px;overflow-x:auto}
.tab{padding:9px 15px;border:none;background:transparent;font-family:inherit;font-size:14px;
  font-weight:600;color:var(--text-3);cursor:pointer;border-bottom:2.5px solid transparent;white-space:nowrap}
.tab:hover{color:var(--text)}
.tab.active{color:var(--navy-700);border-bottom-color:var(--gold)}

.kv{display:grid;grid-template-columns:auto 1fr;gap:9px 16px;font-size:13.8px}
.kv dt{color:var(--text-3);font-weight:600}
.kv dd{margin:0;font-weight:600}

.tag{display:inline-block;background:var(--blue-bg);color:var(--blue);padding:1px 9px;
  border-radius:99px;font-size:11.5px;font-weight:700;margin-inline-end:4px}

/* ============================ الشاشات الصغيرة ============================ */
@media (max-width:1000px){
  .archive{grid-template-columns:1fr}
  .tree-panel{position:static;max-height:360px}
}
@media (max-width:760px){
  .only-mobile{display:inline-grid}
  .sidebar{position:fixed;inset-block:0;inset-inline-end:0;transform:translateX(100%);
    transition:transform .22s;box-shadow:var(--shadow-lg)}
  .app.menu-open .sidebar{transform:translateX(0)}
  .app.menu-open .scrim{display:block;position:fixed;inset:0;background:rgba(8,26,51,.5);z-index:25}
  .content{padding:16px}
  .topbar{padding:12px 16px}
  .clock{display:none}
  .stats{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
  .stat{padding:14px;gap:11px}
  .stat-val{font-size:21px}
  .perm-head,.perm-row{grid-template-columns:1fr repeat(5,50px)}
  .perm-head>div{font-size:10.5px;padding:8px 2px}
  .modal-foot{flex-wrap:wrap}
  .modal-foot .btn{flex:1;justify-content:center}
}
/* ============================ لمسات نهائية ============================ */
/* رأس الجدول يثبت بالأعلى وقت التمرير */
@media (min-width:1001px){
  .table-wrap{overflow-x:visible}
  .files-table thead th{position:sticky;top:63px;z-index:5;background:#f4f7fb;
    box-shadow:inset 0 -1px 0 var(--line),0 1px 0 var(--line)}
  /* لما يكون أكو تحديد، رأس الجدول ينزل تحت شريط الإجراءات */
  #filesArea.has-bulk .files-table thead th{top:112px}
}
.files-table tbody tr{position:relative}
.files-table tbody tr:hover{background:#f6f9fd}
.files-table tbody tr:hover .t-title{color:var(--navy-700)}
.files-table tbody tr td:first-child{box-shadow:inset -3px 0 0 transparent;transition:box-shadow .14s}
.files-table tbody tr:hover td:first-child{box-shadow:inset -3px 0 0 var(--gold)}
th{letter-spacing:.01em}
.card{box-shadow:0 1px 2px rgba(8,26,51,.05),0 6px 20px -12px rgba(8,26,51,.18)}
.tree-panel{max-height:calc(100vh - 118px)}
.tree-scroll{padding:10px 10px 14px}
.content{padding-bottom:40px}
@media print{.sidebar,.topbar,.toasts{display:none}.content{padding:0}}
